-(UIView*)keyboardView{NSArray*windows=[[UIApplicationsharedApplication]windows];for(UIWindow*windowin[windowsreverseObjectEnumerator]){for(UIView*viewin[windowsubviews]){// UIPeripheralHostView is used from iOS 4.0, UIKeyboard was used in previous versions,UIInputSetContainerView was used iOS 8.0if(!strcmp(object_getClassName(view),"UIPeripheralHostView")||!strcmp(object_getClassName(view),"UIKeyboard")||!strcmp(object_getClassName(view),"UIInputSetContainerView")){returnview;}}}returnnil;}-(UIView*)keyboardViewForView:(UIView*)view{UIView*keyboardView=[selfkeyboardView];if(keyboardView){view=keyboardView.superview;}returnview;}