General keyboard recycling code for IOS and keyboard recycling code for ios
I feel tired of Using IOS keyboards, So I encapsulated a general method.
-(IBAction)spbResignFirstResponder:(id)sender{ // NSLogObj(sender); if (sender == NULL || [sender isKindOfClass:[UITapGestureRecognizer class]]) { if (self.view != NULL && self.view.subviews != NULL && self.view.subviews.count > 0) { for (UIView *item in self.view.subviews) { if ([item isKindOfClass:[UITextField class]] || [item isKindOfClass:[UITextView class]]) { UITextField *textField_item = (UITextField *)item; [textField_item resignFirstResponder]; } [self spbResignFirstResponder:item]; } } }else if ([sender isKindOfClass:[UIView class]]) { UIView *view_item = sender; if ([view_item isKindOfClass:[UITextField class]] || [view_item isKindOfClass:[UITextView class]]) { [view_item resignFirstResponder]; } if (view_item.subviews != NULL && view_item.subviews.count > 0) { for (UIView *item in view_item.subviews) { [self spbResignFirstResponder:item]; } } }}
In iOS development, when the keyboard pops up, what code can be used to obtain the type of the pop-up keyboard?
Register the message [[NSNotificationCenter defaultCenter] addObserver: self selector: @ selector (keyboardWillShown :) name: UIKeyboardWillShowNotification object: nil] displayed on the keyboard;
Then in the message return Method
-(Void) keyboardWillShown :( NSNotification *) aNotification {// The keyboard information dictionary NSDictionary * info = [aNotification userInfo];} You should have enough content in this dictionary, the total height of a keyboard, etc.
How can iOS use code to hit other places on the screen and let the keyboard bounce back?
You mean to hide the keyboard after it comes out, right? You can go to the lazy ios code library to see what you may need... the instance has several combinations of idaozenm ..