问题
I would like to be able to have another control become the first responder yet keep the keyboard showing to the user.
I found disablesAutomaticKeyboardDismissal in UIViewController and overrode it but it never get's called (iOS 5.0)
Is there a reason this method would not get called? Is there another way to keep the keyboard showing even though it's not required by the first responder?
回答1:
Though it felt a bit like a hack what I did was make override canBecomeFirstResponder on UIView to return YES and then implement the UIKeyProtocol
https://developer.apple.com/library/IOS/documentation/UIKit/Reference/UIKeyInput_Protocol/Reference/Reference.html
But did nothing on key press. This way the keyboard stays open but the keys don't matter.
来源:https://stackoverflow.com/questions/18411562/stop-automatic-dismissal-of-keyboard-on-ios-disablesautomatickeyboarddismissal-n