I have a UINavigationController with two screens - each screen with its own nav controller. The first screen has no entry boxes but the second screen (that is pushed onto the nav controller stack) does have a UITextView in it.
UITextView *commentTextView;
My questions is: How do I make the UIKeyboard disappear when the user uses the back button on the nav controller bar to pop the UIView off the nav controller stack and show the previous screen?
I have tried using [commentTextView resignFirstResponder] in a number of places but it never works. The keyboard is still visible even when the UIView has disappeared.
I've tried putting resignFirstResponder call in:
-(void)viewWillDisappear:(BOOL)animated
of the view and also I've tried registering a notification when the UITextView has finished editing like:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidBeginEditingNotification object:nil];
but again, this doesn't work when the user dismisses the UIView by using the Nav Controller's back button.
I'm not sure if I've described this question brilliantly (my first day on stack overflow!) but does anybody have any ideas on this one?