UITextField focus

后端 未结 2 1475
名媛妹妹
名媛妹妹 2020-12-13 08:40

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

相关标签:
2条回答
  • 2020-12-13 09:05

    Try doing this in viewWillAppear:

    [desiredField becomeFirstResponder];
    

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

    0 讨论(0)
  • 2020-12-13 09:07

    Set the first responder for your view to be the text field. This can be done in IB.

    0 讨论(0)
提交回复
热议问题