【发布时间】:2018-11-18 11:21:47
【问题描述】:
我用过:
NotificationCenter.default.addObserver(self, selector:#selector(keyboardWillShow), name: .UIKeyboardWillShow, object: nil)
@objc func keyboardWillShow(notification: NSNotification) {
if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue {
let keyboardHeight : Int = Int(keyboardSize.height)
print("keyboardHeight",keyboardHeight)
KeyboardHeightVar = keyboardHeight
}
}
更改以获得键盘的高度,但高度不包括建议栏。 如何获取键盘高度加上建议栏高度的值?
【问题讨论】: