How to open the keyboard automatically on UITextField?

eemceebee picture eemceebee · Feb 16, 2010 · Viewed 59.6k times · Source

I have a very simple table and when tocuh a cell it opens a new view with one UITextfield. All I want is that the keyboard will automatically opens, without the user have to touch the UITextfield.

Its all done in Interface Builder, so I am not sure how I do this. I guess I need to set the focus at some point ?

Thanks

Answer

jessecurry picture jessecurry · Feb 16, 2010

To cause the keyboard to show up immediately you'll need to set the text field as the first responder using the following line:

[textField becomeFirstResponder];

You may want to place this in the viewDidAppear: method.