How to hide keyboard after a push on an UINavigationBar back button on ios
back-button, ios, keyboard
Solution
Put this into the buttonPress method -
[self.view.window endEditing:YES];
Edit - this also lets you get the contents of the text being edited when the "back" button is pressed
Problem
My keyboard appears with a textView, I want to hide it when the user push on a back button on a navigation bar. I have tried this: ``` -(void)viewWillDisappear:(BOOL)animated{ [myTextView resignFirstResponder]; } ``` and this: ``` -(void)viewDidDisappear:(BOOL)animated{ [myTextView resignFirstResponder]; } ``` But it doesn't work, how can I do this? edit: I found the solution here: iPad keyboard will not dismiss if modal ViewController presentation style is UIModalPresentationFormSheet