Change return to done on keyboard

Discussion in 'iPhone/iPad Programming' started by seVor, Aug 20, 2008.

  1. macrumors newbie

    Joined:
    Aug 20, 2008
    #1
    I know its a dumb question but how can I change the return button on the keyboard to done?
     
  2. macrumors newbie

    Joined:
    Jul 17, 2008
    #2
    it is just simple
    I u r using..........NIb file then u can simply change using properties
    or if u r doing programtically
    then simply use this
    UITextView *textField = [[UITextView alloc] initWithFrame:frame];
    textField.returnKeyType = UIReturnKeyDone;

    i think now u can do.
     
  3. thread starter macrumors newbie

    Joined:
    Aug 20, 2008
    #3
    Cool Thanks..... Oh How do you handle the done key? I have a button on my screen and I want the done key to do the same functionality.
     
  4. macrumors regular

    Joined:
    Mar 28, 2008
    #4
    you need to implement the following.
    Code:
    -(BOOL) textFieldShouldReturn:(UITextField *)textField
    Ex:
    Code:
    -(BOOL) textFieldShouldReturn:(UITextField *)textField
    {
    	if (textField == txtUserName) [txtPassword becomeFirstResponder]; //Set focus to password field
    	else if (textField == txtPassword) [self OnLogin: textField];     //Call OnLogin
    
    	return YES;
    }
     

Share This Page