How do I set a particular UITextField on my firstViewController to focus when my sec开发者_StackOverflowondViewController pops from the navigationController?
Write [TexfieldName becomeFirstResponder];
in ViewdidLoad in secondViewController.
This will focus to particular textField and show keyboard.
If you don't want to use viewWillAppear:
, you could make use of the UINavigationControllerDelegate
method – navigationController:willShowViewController:animated:
and make invoke your method that way instead.
Just make sure some class is the delegate
of you navigation controller, and get it to call a method in firstViewController
invoking becomeFirstResponder
.
EDIT: Link to the Apple documentation on UINavigationControllerDelegate.
精彩评论