开发者

Set focus of UITextField of firstViewController on secondViewController

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜