Reputation:
My app has started crashing on disablesAutomaticKeyboardDismissal = true
in my view controller on iOS 9.3.5 and earlier.
I'm getting:
-[ViewController setDisablesAutomaticKeyboardDismissal:]: unrecognized selector sent to instance
Is there an elegant way to work around this problem? I'm using Swift in my project.
Upvotes: 3
Views: 1650
Reputation:
I'm pretty sure it's a bug. Something like this should never happen.
Also, the correct way of using this API seems to be overriding this property of a UIViewController
, not setting its value.
override var disablesAutomaticKeyboardDismissal: Bool {
get { return true } // or false
set { }
}
Thanks to matzino for the tip.
Upvotes: 1
Reputation: 3310
There is also anther way to dismiss keyboard. you just need to write
self.view.endEditing(true)
when you need to require dismiss keyboard.
Upvotes: 0