ios处理键盘的大小

2016-07-24  本文已影响265人  我是花老虎
  1. iOS的键盘有几个通知
UIKeyboardWillShowNotification
UIKeyboardDidShowNotification
UIKeyboardWillHideNotification
UIKeyboardDidHideNotification
  1. 每一个通知的具体内容是什么呢
    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;
  1. 键盘大小的转换
    通知里的大小是屏幕坐标系中的大小和位置,没有考虑旋转。因此需啊一次转化。
        let rect = self.view.convertRect(keyboardrect!, fromView: nil)
  1. 为啥不能假设键盘有一个固定的大小
上一篇下一篇

猜你喜欢

热点阅读