Hello I have two UITextFields in my application, and want to dismiss the keyboard when I just touch anywhere except the UITextFields how can I do this?
use tochesBegin method for this purpose
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[yourFirstTextField resignFirstResponder];
[yourSecondTextField resignFirstResponder];
}
You do not need any thing else.When you touch anywhere on view then both textField resign no need to to know which one having focus.and when you touch textField then textField open keyboard by own.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With