如何在没有动画的情况下显示键盘 (Swift, iOS9)?

How to show keyboard without animation (Swift, iOS9)?

我知道这个问题已经有了答案,但是 none 其中的答案对我来说确实有用,或者至少我没有足够的经验来实施它们。有什么直接的方法可以实现这一目标吗?我在 UIKeyboardWillShowNotificationtextField.becomeFirstResponder() 之后)触发的方法中获得键盘高度,所以最好是有人给我具体的代码行。谢谢

遇到了一些麻烦,我设法处理了它。

viewDidLoad 中的通知观察者:

NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardShown:", name: UIKeyboardDidShowNotification, object: nil)

Vi 中任何地方的方法

func keyboardShown(notification: NSNotification) {
    let info  = notification.userInfo!
    let value: AnyObject = info[UIKeyboardFrameEndUserInfoKey]!

let rawFrame = value.CGRectValue()
let keyboardFrame = view.convertRect(rawFrame, fromView: nil)

println("keyboardFrame: \(keyboardFrame)")
}