0

I want the return button on my UITextField's keyboard to hide the keyboard. I am not sure whether to use the 'Return' or 'Done' label for this.

I have seen 'Return' used variously to hide the keyboard, insert a new line, and move to the next field. I have seen 'Done' used variously to hide the keyboard, move to the next field, and submit the form.

Is there any HIG or other Apple discussion of this? Even their own apps seem to vary in their implementation.

I have no issue using either label, only a desire to meet my user's expectations on the platform.

Ben Packard
  • 24,060
  • 24
  • 94
  • 172

1 Answers1

0

You are right 'Return' is mostly used for new line. 'Done' for hide the keyboard and submit the form.

My suggestion is go for 'Done' to hide the keyboard. You can set it from storyboard/Nib or programmatically:

textField.returnKeyType = UIReturnKeyDone;

and

[textField addTarget:self action:@selector(textFieldFinished:) forControlEvents:UIControlEventEditingDidEndOnExit];

and

- (IBAction)textFieldFinished:(id)sender
{
    // [sender resignFirstResponder];
    // submit your form
}
Abdullah Umer
  • 3,788
  • 5
  • 31
  • 56
  • The problem with 'Done' is that it implies a more meaningful action - re-enforced by the fact that the button is tinted blue, in the same style as a toolbar action button. Each has pros and cons but I'm hoping there is a semi-official guideline someone can point to. – Ben Packard Dec 15 '12 at 18:57