keyboard height varies in ios8

故事扮演 提交于 2019-12-06 11:59:12

Simply Replace the line from your code

CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

With

CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;

Let me know if it works

This is not an issue, you are getting different size keyboard because Predictive is Enable.

The height of keyboard is 216 which is fixed but when Predictive is Enabled you will get 253 as height.

So you have to write code for both conditions.

use this code, may help you

- (void)keyboardWillShow:(NSNotification*)note {
      NSDictionary* info = [note userInfo];
      CGSize _kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
      float kbHeight = _kbSize.width > _kbSize.height ? _kbSize.height : _kbSize.width;
}

kbHeight variable stored height of the keyboard.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!