Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chelsel

macrumors 6502
Original poster
May 24, 2007
455
229
I'm creating a username/password view with two fields. I want the app to start with the cursor already blinking in the UITextField with the keyboard visible.

The Facebook app does this but I can't figure out how to get the same effect in my app (showing the keyboard immediately with the cursor in the first field).

Any ideas?

Thanks!
 

Enuratique

macrumors 6502
Apr 28, 2008
276
0
I'm creating a username/password view with two fields. I want the app to start with the cursor already blinking in the UITextField with the keyboard visible.

The Facebook app does this but I can't figure out how to get the same effect in my app (showing the keyboard immediately with the cursor in the first field).

Any ideas?

Thanks!

If you have IBOutlets for your UITextViews hooked up to your view controller, once the view has finished loading (perhaps in viewDidLoad) you can tell the username UITextView to become the first responder, which gives focus and displays the keyboard.

Code:
[usernameTextField becomeFirstResponder];

Try that and see if it works.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.