UIKeyboardWillShowNotification未在iOS 5中调用未对接的键盘 [英] UIKeyboardWillShowNotification not called for an undocked keyboard in iOS 5

查看:119
本文介绍了UIKeyboardWillShowNotification未在iOS 5中调用未对接的键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现当<$ c中出现未停靠/拆分键盘时,不会生成 UIKeyboardWillShowNotification UIKeyboardDidShowNotification $ c> iOS 5 。例如,点击文本字段以显示键盘(生成通知),取消键盘,点击文本字段以关闭键盘,再次点击文本字段以显示未停靠的键盘(通知

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?

推荐答案

您需要观察 UIKeyboardWillChangeFrameNotification UIKeyboardDidChangeFrameNotification 代替。当你得到它们时,你可以查看 UIKeyboardFrameEndUserInfoKey 的值(如果它存在,它并不总是在拖动键盘时)并查看该矩形是否与窗口相交看看键盘现在是开启还是关闭。

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.

这篇关于UIKeyboardWillShowNotification未在iOS 5中调用未对接的键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆