KeyBoard 在iOS7和iOS8上通知的区别
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了KeyBoard 在iOS7和iOS8上通知的区别,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2491字,纯文字阅读大概需要4分钟。
内容图文
首先注册通知如下:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow:", name:UIKeyboardWillChangeFrameNotification, object:nil)
func keyboardWillShow(noti:NSNotification){
var userInfo :NSDictionary = noti.userInfo!
var duration : NSValue = userInfo["UIKeyboardAnimationDurationUserInfoKey"]asNSValue
var animationDuration : NSTimeInterval ! = 0
duration.getValue(&animationDuration)
var keyFrame : NSValue = userInfo[ "UIKeyboardFrameEndUserInfoKey" ] as NSValue
var krect = keyFrame.CGRectValue()
}打印内容如下:
注明:这是iPad横向的时候哦。
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}}";
}
键盘响应,收回resignFirstResponder
UIKeyboardWillChangeFrameNotification; userInfo = {
UIKeyboardAnimationCurveUserInfoKey = 7;
UIKeyboardAnimationDurationUserInfoKey = "0.25";
UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {1024, 406}}";
UIKeyboardCenterBeginUserInfoKey = "NSPoint: {512, 565}";
UIKeyboardCenterEndUserInfoKey = "NSPoint: {512, 971}";
UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 0}, {406, 1024}}";
UIKeyboardFrameChangedByUserInteraction = 0;
UIKeyboardFrameEndUserInfoKey = "NSRect: {{-406, 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}}";
}
{
UIKeyboardAnimationCurveUserInfoKey = 7;
UIKeyboardAnimationDurationUserInfoKey = "0.25";
UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {1024, 406}}";
UIKeyboardCenterBeginUserInfoKey = "NSPoint: {512, 565}";
UIKeyboardCenterEndUserInfoKey = "NSPoint: {512, 971}";
UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 362}, {1024, 406}}";
UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 768}, {1024, 406}}";
}
原文:http://blog.csdn.net/yanyanforest/article/details/44803503
内容总结
以上是互联网集市为您收集整理的KeyBoard 在iOS7和iOS8上通知的区别全部内容,希望文章能够帮你解决KeyBoard 在iOS7和iOS8上通知的区别所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。