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.

4

1 回答 1

2

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

[theTextField resignFirstResponder];

This will dismiss the keyboard.

于 2009-10-08T02:17:44.793 回答