views:

632

answers:

1

There is a 'Done' button on the input pad on iphone, but there is no action to it by default. Can I add an action to it? For example, hide the input pad when 'Done' is pressed?

+4  A: 

In your keyboard delegate you need to give up the focus. E.g

- (BOOL)textFieldShouldReturn:(UITextField *)aTextField 
{
  [aTextField resignFirstResponder];
  return YES;
}

This works for both the done and return keys.

Andrew Grant
Thanks, this works well.
iPhoney