关于iPad键盘高度变更的通知
我正在尝试在 iPad 键盘顶部显示 UITextField。
当通知出现时,我能够获得键盘的高度。
然而,在iPad中,通过更改键盘的语言输入->最有可能的是日语,键盘的高度发生了变化,因为键盘顶部显示了一个文本假设区域,这导致我的 UITextfield 被该区域隐藏......
有谁知道我如何获得高度更改通知或任何其他方式?
I am trying to show a UITextField on top of the iPad keyboard.
I was able to get the height of the keyboard when it was presented with the notification.
However, in iPad, by change the language input of the keyboard -> most likely to Japanese, the height of the keyboard changed because a text-hypothesis area was shown on top of the keyboard, that caused my UITextfield hidden by that area....
Does anybody know how can I get the height changed notification or any other way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案是,当您切换语言时,每次更改都会触发
UIKeyboardDidShowNotification
,因此您始终可以获得更新的高度。请在此处查看我的答案,了解如何设置对显示和隐藏以及获取的响应高度。
The answer is that when you switch languages, the
UIKeyboardDidShowNotification
fires for each change, so you always get the updated height.See my answer here on how to set up responses to the showing and hiding, and getting the height.
Swift
UIKeyboardDidShowNotification
将不再触发键盘尺寸更改。使用
UIKeyboardWillChangeFrameNotification
代替:在函数中:
重要: 当键盘打开和隐藏时,此事件也会被触发,可以替换
UIKeyboardWillShowNotification
和UIKeyboardWillHideNotification
如果只需要尺寸Swift
The
UIKeyboardDidShowNotification
won't fire anymore the keyboard size change.Use
UIKeyboardWillChangeFrameNotification
instead:at the function:
Important: this event will be fired also when keyboard will open and will hide, can replace both
UIKeyboardWillShowNotification
andUIKeyboardWillHideNotification
if only sizes are needed