简体   繁体   English

立即切换输入类型时,如何在iOS 11中获得表情符号键盘的高度?

[英]How to get height of emoji keyboard in iOS 11 when switching input type immediately?

I am using the code below: 我正在使用以下代码:

CGRect keyboardFrame = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];

but it doesn't work exactly. 但这并不完全有效。

You can subscribe to notifications: UIKeyboardWillChangeFrame or UIKeyboardDidChangeFrame . 您可以订阅通知: UIKeyboardWillChangeFrameUIKeyboardDidChangeFrame In handlers you can get the end frame of the keyboard. 在处理程序中, 您可以获取键盘的末端框架
Here I've created an example application. 在这里,我创建了一个示例应用程序。

When switching to emoji keyboard by pressing the language selector button (the globe), it seems that a UIKeyboardWillChangeFrame -notification gets sent. 通过按语言选择器按钮(地球)切换到表情符号键盘时,似乎已发送UIKeyboardWillChangeFrame -notification。 But when changing by long pressing the language selector button, no notification is sent. 但是,如果长按语言选择器按钮进行更改,则不会发送任何通知。

It looks to me as a bug in iOS 11, since even the apple messages app and facebook messenger app doesn't handle this right. 在我看来,这似乎是iOS 11中的错误,因为即使Apple Messages应用程序和Facebook Messenger应用程序也无法处理此问题。 I've submitted a radar about this with id: 36657137 我已提交有关此ID的雷达 :36657137

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM