To close the keyboard after the keyboard appears, there are 2 cases ,
2. When the UITextField is outside the UIScrollView override the method in your subclass of the UIViewController
you must also add a delegate for all UITextView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.view endEditing:YES]; }
- In the scroll view, clicking on the outside will not trigger any event , so in this case, use the stiffness handle pointer , Drag and Drop UITapGesture to scroll and create an IBAction for it .
to create an IBAction, press ctrl + click UITapGesture and drag it into the .h viewcontroller file.
Here I called tappedEvent the name of my action
- (IBAction)tappedEvent:(id)sender { [self.view endEditing:YES]; }
The information indicated was obtained from the following link, please contact for more information or contact me if you do not understand the abouve data.
http://samwize.com/2014/03/27/dismiss-keyboard-when-tap-outside-a-uitextfield-slash-uitextview/
KRSaravana Kumar Dec 02 '15 at 5:18 2015-12-02 05:18
source share