KeyBoard 在iOS7和iOS8上通知的区别

首先注册通知如下:

, selector: "keyboardWillShow:", name:UIKeyboardWillChangeFrameNotification, object:nil)

通知内容:

func keyboardWillShow(noti:NSNotification){

var userInfo :NSDictionary = noti.userInfo!

= userInfo["UIKeyboardAnimationDurationUserInfoKey"]asNSValue

var animationDuration :NSTimeInterval! =0

duration.getValue(&animationDuration)

]

var krect = keyFrame.CGRectValue()

}

打印内容如下:

iOS7.1:

{

UIKeyboardAnimationCurveUserInfoKey = 7;

UIKeyboardAnimationDurationUserInfoKey = "0.25";

UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {1024, 406}}";

UIKeyboardCenterBeginUserInfoKey = "NSPoint: {512, 971}";

UIKeyboardCenterEndUserInfoKey = "NSPoint: {512, 565}";

UIKeyboardFrameBeginUserInfoKey = "NSRect: {{-406, 0}, {406, 1024}}";

UIKeyboardFrameChangedByUserInteraction = 0;

UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 0}, {406, 1024}}";

}

iOS8:

{

UIKeyboardAnimationCurveUserInfoKey = 7;

UIKeyboardAnimationDurationUserInfoKey = "0.25";

UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {1024, 406}}";

UIKeyboardCenterBeginUserInfoKey = "NSPoint: {512, 971}";

UIKeyboardCenterEndUserInfoKey = "NSPoint: {512, 565}";

UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 768}, {1024, 406}}";

UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 362}, {1024, 406}}";

}

,只有一条路不能拒绝——那就是成长的路。

KeyBoard 在iOS7和iOS8上通知的区别

相关文章:

你感兴趣的文章:

标签云: