ios – UIKeyboardWillShow通知返回错误的框架为快速键盘

前端之家收集整理的这篇文章主要介绍了ios – UIKeyboardWillShow通知返回错误的框架为快速键盘前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用UIKeyboardWillShowNotification和UIKeyboardWillHideNotification来处理键盘.
这是当键盘显示调用函数
  1. -(void) keyboardWillShow:(NSNotification *)note
  2. {
  3. CGRect keyboardBounds;
  4. //[[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds];
  5. NSValue* keyboardFrameBegin = [note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey];
  6. keyboardBounds = [keyboardFrameBegin CGRectValue];
  7. }

我得到keyboardBounds =(0,524,320,44),我使用5s.不知道为什么origin.y来了524(应该在300附近),高度为44!
我也尝试了这条评论.键盘绑定的方式都是44.这个问题只适用于快速键盘.
this issue相同

解决方法

那么问题是用swift键盘,方法 – (void)keyboardWillShow

猜你在找的iOS相关文章