博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

UITextField 获取焦点

Posted on 2011-09-23 15:29  星尘的天空  阅读(2667)  评论(0编辑  收藏  举报

How can I programmatically assign focus to a specific UITextField in a view? I have several fields and on view display, I'd like to put the cursor on a specific field, not the first one at top.



Try doing this in viewWillAppear:

[desiredField becomeFirstResponder];

By making the field the first responder, it have focus and the keyboard will be displayed.

THE END !