Tutorial :Dismiss keyboard on IPAD



Question:

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

Thanks,


Solution:1

UPDATE This answer is no longer accurate. See the correct answer.

If your UITextField is in a modal page sheet view (UIModalPresentationFormSheet), then there is (currently) no way to force the device to dismiss the keyboard this devforums post from an apple engineer.


Solution:2

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.


Solution:3

Now we can

- (BOOL)disablesAutomaticKeyboardDismissal {      return NO;  }  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »