Wednesday, April 6, 2011

Can I add action to 'Done' button on input pad on iPhone?

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?

From stackoverflow
  • 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.

    iPhoney : Thanks, this works well.

0 comments:

Post a Comment