0

I have a UITableView with two Custom Cells. One of the Custom Cells contains a UITextField.

I'm having problems with hiding the keyboard when the return button is pressed.

- (IBAction)textFieldDoneEditing:(id)sender {
     [sender resignFirstResponder];
  }

Normally I would use this, but it get's never called. I connected it with the Editing Did End Event.

Is is because I use a Custom Cell ?

Backslash
  • 343
  • 5
  • 12

1 Answers1

1

No need to wire up an IBAction. Use the delegate method (I also change my return key in IB to Done to make it more apparent to the user). Make sure you have connected the delegate for the textfield to your VC class.

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    // Dismiss the keyboard when the Return key is pressed.
    [textField resignFirstResponder];

    return YES;
}
LJ Wilson
  • 14,445
  • 5
  • 38
  • 62