Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dismiss keyboard on IPAD

The ResignFirstResponder for an UITextField on the Iphone semms to not working for the Ipad. How can I dismiss my keyboard programmatically?

Thanks,

like image 842
ludo Avatar asked Jul 23 '10 08:07

ludo


2 Answers

In iOS 4.3, Apple introduced the above mentioned method, disablesAutomaticKeyboardDismissal. It returns YES for UIModalPresentationFormSheet, preventing the keyboard from dismissing.

Overriding this method works, but if you present your view controller inside a UINavigationController, you must subclass UINavigationController and override the method there.

I've confirmed that this does indeed work on iOS 6. Just make sure to pay attention to the UINavigationController clause.

like image 146
Quentamia Avatar answered Oct 21 '22 07:10

Quentamia


Now we can

- (BOOL)disablesAutomaticKeyboardDismissal {
    return NO;
}
like image 21
ader Avatar answered Oct 21 '22 05:10

ader