I\'m trying to get rid of the keyboard when the user touch outside my UITextField, by using this method:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEven
You need to change your ViewController's
view property from UIView
to UIControl
using the Identity Inspector:
From there, you simply create an IBAction
and tell the textfield to dismiss (which I am assuming is your mainTextController
). If mainTextController
is not the textfield you want the keyboard to dismiss on then change the resignFirstReaponder
method to your textfield like so.
- (IBAction)backgroundTap:(id)sender {
[myTextField resignFirstResponder];
}
then from there go back into your View Contoller's .xib
file and connect the action to the Control View and select "Touch Down".