Reputation: 14834
I have this setup: A main UIView
contains an UITextView
that has a UITextField
as subview. When I dismiss the the keyboard from the UITextField
using resignFirstResponder
. The keyboard is dismissed. But it animates back again for the UITextView
.
My desired outcome was to dismiss keyboard completely.
I have tried these individually and combination of one or more:
[self endEditing:YES]; // for the main UIView
[myTextView resignFirstResponder]; //UITextView
[myTextField resignFirstResponder]; //UITextField
Edit: As it turned out, it just something that I overlooked. But none seemed to dismiss the keyboard completely.
Any suggestions?
Upvotes: 1
Views: 176
Reputation: 1685
You could subclass UITextView and override some of the UIResponder methods. Namely canBecomeFirstResponder and return NO when the UITextField was the first responder.
Upvotes: 1
Reputation: 3092
Have you tried setting the "firstResponder" to another view? That's how I dismissed the keyboard in those cases.
Upvotes: 1
Reputation: 585
Try this:
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
Upvotes: 2