iOS的键盘有几个通知
UIKeyboardWillShowNotification
UIKeyboardDidShowNotification
UIKeyboardWillHideNotification
UIKeyboardDidHideNotification
每一个通知的具体内容是什么呢
UIKeyboardAnimationCurveUserInfoKey = 7;
UIKeyboardAnimationDurationUserInfoKey = "0.25";
UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {375, 258}}";
UIKeyboardCenterBeginUserInfoKey = "NSPoint: {187.5, 796}";
UIKeyboardCenterEndUserInfoKey = "NSPoint: {187.5, 538}";
UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 667}, {375, 258}}";
UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 409}, {375, 258}}";
UIKeyboardIsLocalUserInfoKey = 1;
键盘大小的转换
通知里的大小是屏幕坐标系中的大小和位置,没有考虑旋转。因此需要一次转化。
let rect = self.view.convertRect(keyboardrect!, fromView: nil)
为啥不能假设键盘有一个固定的大小
原文:http://www.cnblogs.com/huahuahu/p/ios-chu-li-jian-pan-de-da-xiao.html