views:

305

answers:

1

I recently discovered that if a UITextField is being edited in a controller that's attached to a UINavigationController and the back button is pressed, upon returning to this controller, the DidBeginEditing function is called again and the UITextField keyboard is brought back up. I was wondering if there's a way to stop the keyboard from coming back up. Maybe there's a way to hook the back button so it doesn't save the fact that the text field is being edited.

+2  A: 

Implement viewWillDisappear: on the view controller that controls the text field, and call:

[theTextField resignFirstResponder];

This will dismiss the keyboard.

cduhn