UITextField Keyboard Focus, ala Facebook App

Discussion in 'iOS Programming' started by chelsel, Jul 13, 2008.

  1. chelsel macrumors 6502

    May 24, 2007
    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?

  2. Enuratique macrumors 6502

    Apr 28, 2008
    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.

    [usernameTextField becomeFirstResponder];
    Try that and see if it works.
  3. chelsel thread starter macrumors 6502

    May 24, 2007

Share This Page