Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I interact with "iPad keyboard hiding button" programmatically?

There is a button at bottom right of iPad keyboard which is to hide the keypad.

enter image description here

How can I interact with it programmatically? (get the button then send UIControlEventTouchUpInside to it).

Does anyone know this?

[Edit] In my case, the keyboard is shown on a modal view.

like image 830
Son Nguyen Avatar asked Apr 29 '11 04:04

Son Nguyen


2 Answers

Overriding disablesAutomaticKeyboardDismissal to return NO as below allows you to dismiss the keyboard when you resignFirstResponder, even when your UITextView is on a modal view. You should put this code to your view controller, from which you initiate the keyboard:

- (BOOL)disablesAutomaticKeyboardDismissal {
    return NO;
}

Source: https://stackoverflow.com/a/6268520

like image 128
lockysoft Avatar answered Sep 20 '22 22:09

lockysoft


In general, you would send the resignFirsResponder message to the active input view.

like image 41
titaniumdecoy Avatar answered Sep 21 '22 22:09

titaniumdecoy