Change return to done on keyboard

Discussion in 'iOS Programming' started by seVor, Aug 20, 2008.

  1. macrumors newbie

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

    Jul 17, 2008
    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

    Aug 20, 2008
    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

    Mar 28, 2008
    you need to implement the following.
    -(BOOL) textFieldShouldReturn:(UITextField *)textField
    -(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