swift2.0 动态获取键盘高度 Get KeyboardHeight

swift2.0 动态获取键盘高度 Get KeyboardHeight,第1张

概述列表内容 监听键盘起落 下面是可以监听到得四种状态 UIKeyboardWillShowNotification: String UIKeyboardDidShowNotification: String UIKeyboardWillHideNotification: String UIKeyboardDidHideNotification: String NSNotificationCenter 列表内容

监听键盘起落 下面是可以监听到得四种状态

UIKeyboarDWillShowNotification: String
UIKeyboardDIDShowNotification: String
UIKeyboarDWillHIDeNotification: String
UIKeyboardDIDHIDeNotification: String

NSNotificationCenter.defaultCenter().addobserver(self,selector: "keyboarDWillAppear:",name: UIKeyboarDWillShowNotification,object: nil)NSNotificationCenter.defaultCenter().addobserver(self,selector: "keyboarDWilldisappear:",name:UIKeyboarDWillHIDeNotification,object: nil)
func keyboarDWillAppear(notification: NSNotification) {        // 获取键盘信息        let keyboardinfo = notification.userInfo![UIKeyboardFrameBeginUserInfoKey]        let keyboardheight:CGfloat = (keyboardinfo?.CGRectValue.size.height)!        print("键盘d起")        print(keyboardheight)    }    func keyboarDWilldisappear(notification:NSNotification){        print("键盘落下")    }
总结

以上是内存溢出为你收集整理的swift2.0 动态获取键盘高度 Get KeyboardHeight全部内容,希望文章能够帮你解决swift2.0 动态获取键盘高度 Get KeyboardHeight所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1083895.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存