Transfer Focus to Next UITextField

Discussion in 'iPhone/iPad Programming' started by rupesh.swami, Mar 9, 2009.

  1. macrumors newbie

    Joined:
    Mar 9, 2009
    #1
    hi all,
    i am newBie to iPhone Programming

    I want to whenever user Press return Key in any UITextField then focus transfer to Next UITextField

    Also how can i make UITextField to Read Only. so user can not type anything in UITextField
     
  2. macrumors 6502

    Joined:
    May 9, 2008
    Location:
    Bangalore
    #2
    Focus to nextField

    In - (BOOL)textFieldShouldReturn:(UITextField *)textField this method before returning yes,textField on which u want to focus just call becomeFirstResponder
    For eample if u have two textfields firstname,lastname if ur in editing mode of firstname when u hit return then just comapre if([textField isEqual:firstname])
    if it is true then [lastName becomeFirstResponder].
    If u want readOnly then set userInteractionEnabled to NO
     
  3. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    Actually, the property is named "enabled" (if accessing via code) but appears as "User Interaction Enabled" in Interface Builder.
     
  4. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #4
  5. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    Ah, sorry about that. I was looking at UITextField's parent class, which is UIControl which has an enabled property. Since Apple changed the name in this class, I supsect there may be differences in which one you use.
     

Share This Page