这是我到目前为止尝试过的
func onKeyboardRaise(notification: NSNotification) {
var notificationData = notification.userInfo
var duration = notificationData[UIKeyboardAnimationDurationUserInfoKey] as NSNumber
var frame = notificationData[UIKeyboardFrameBeginUserInfoKey]! as NSValue
var frameValue :UnsafePointer<(CGRect)> = nil;
frame.getValue(frameValue)
}
但我似乎总是崩溃frame.getValue(frameValue)
。
这有点令人困惑,因为文档UIKeyboardFrameBeginUserInfoKey
说它返回一个CGRect
对象,但是当我登录frame
控制台时,它会声明类似NSRect {{x, y}, {w, h}}
.