UIKeyboardWillShowNotification not called for an undocked keyboard in iOS 5

只愿长相守 提交于 2019-12-18 14:53:32

问题


I have found that UIKeyboardWillShowNotification and UIKeyboardDidShowNotification are not generated when an undocked/split keyboard appears in iOS 5. For instance, tap into a text field to show the keyboard (notifications are generated), undock the keyboard, tap out of the text field to dismiss the keyboard, tap on the text field again to show the undocked keyboard (notifications are not generated).

Is there any way to detect when the keyboard appears regardless of whether it is docked or not?


回答1:


You need to observe UIKeyboardWillChangeFrameNotification and UIKeyboardDidChangeFrameNotification instead. When you get them, you can look at the value for UIKeyboardFrameEndUserInfoKey (if it exists, it doesn't always while dragging the keyboard) and see if that rect intersects the window to see if the keyboard is now on or off screen.




回答2:


If the keyboard appears undocked / split, you don't need to detect it. The whole point of the undocked / split keyboard is that the user can move it freely if it's in the way.



来源:https://stackoverflow.com/questions/7799421/uikeyboardwillshownotification-not-called-for-an-undocked-keyboard-in-ios-5

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