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

it is not working....

Brandon Bodnar
  • 8,202
  • 2
  • 36
  • 42
jmj
  • 237,923
  • 42
  • 401
  • 438

1 Answers1

3

This answer demonstrates that the delegate decides whether or not to dismiss the keypad.

If you want to dismiss the keypad, textFieldShouldReturn: must return NO:

-(BOOL) textFieldShouldReturn:(UITextField*) theTextField{
    [theTextField resignFirstResponder];
    return NO;
}
Community
  • 1
  • 1
Frank Shearar
  • 17,012
  • 8
  • 67
  • 94
  • 2
    This no longer appears to work for number pad for iOS 7.1 The method does not get called if the keyboard type is number pad but does if it's the default keyboard type. – james2code Apr 04 '14 at 19:33