a CGRect
和an 之间有什么区别NSRect
吗?特别是,我想知道原点的位置.我需要了解哪些重要的差异?
这是我到目前为止所尝试的内容
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)
}
Run Code Online (Sandbox Code Playgroud)
但我似乎总是崩溃frame.getValue(frameValue)
.
它有点令人困惑,因为文档UIKeyboardFrameBeginUserInfoKey
说它返回一个CGRect
对象,但是当我登录frame
控制台时,它表示类似的东西NSRect {{x, y}, {w, h}}
.