3

I've subclassed a UITextField to display a UIDatePicker instead of a keyboard. Entering dates is something that happens often I our app. The problem occurs when another of our custom classes that accommodates the keyboard needs to know what the first responder.

Is there a way to remain first responder, whilst hiding keyboard?

Benjamin
  • 663
  • 8
  • 23

2 Answers2

3

No, you have to resign as responder (give up focus) to dismiss the keyboard.

Edit: It seems I lied. Try [self.view endEditing:YES];
FYI: It only works on iOS 3.2+

1

Actually, instead of subclassing, you should just make a custom inputView for your text field which uses a date picker as the custom "keyboard". Then, it will remain the first responder and never even call the system keyboard in the first place.

lnafziger
  • 25,760
  • 8
  • 60
  • 101