这是我到目前为止所尝试的内容
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对象,但是当我在控制台中记录帧时,它会声明类似NSRect {{x,y},{w,h}}的内容.