Dismiss keyboard on IPAD

后端 未结 3 1836
既然无缘
既然无缘 2020-12-16 20:59

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

Thanks,

3条回答
  •  被撕碎了的回忆
    2020-12-16 21:23

    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.

提交回复
热议问题