简体   繁体   English

如何确定用户在iPad上的iOS5中拆分了键盘

[英]How to know for sure that user splitted the keyboard in iOS5 on iPad

all. 所有。

I'm trying to catch the keyboard split event on iPad, iOS5. 我试图在iPad,iOS5上捕捉键盘分割事件。 I've registered method for all keyboard notifications and that's what notification I get when I split the keyboard (in the order of appearance): 我已经注册了所有键盘通知的方法,这是我分割键盘时的通知(按照外观顺序):

UIKeyboardWillHideNotification UIKeyboardWillChangeFrameNotification UIKeyboardDidHideNotification UIKeyboardDidChangeFrameNotification UIKeyboardDidChangeFrameNotification UIKeyboardWillHideNotification UIKeyboardWillChangeFrameNotification UIKeyboardDidHideNotification UIKeyboardDidChangeFrameNotification UIKeyboardDidChangeFrameNotification

So, no WillShow or DidShow notification, but the keyboard is still on the screen. 所以,没有WillShow或DidShow通知,但键盘仍在屏幕上。

The two consequent UIKeyboardDidChangeFrameNotification would have helped (I could have contained positions of the both parts of the keyboard), but, alas, UIKeyboardFrameEndUserInfoKey key contains the same value (origin (352; 0), size (316; 1024)) for both notifications. 两个随之而来的UIKeyboardDidChangeFrameNotification会有所帮助(我可以包含键盘两个部分的位置),但是,唉,UIKeyboardFrameEndUserInfoKey键包含两个通知的相同值(origin(352; 0),size(316; 1024)) 。

So the question is: how to catch the split keyboard event in iPad, iOS5? 所以问题是:如何在iPad,iOS5中捕捉分裂键盘事件?

When the keyboard is docked, UIKeyboardWillShowNotification will be raised. 当键盘停靠时,将引发UIKeyboardWillShowNotification If the keyboard is split or undocked, no keyboard notifications are raised. 如果键盘已拆分或未对接,则不会引发键盘通知。

If a keyboard is docked, UIKeyboardWillShowNotification will be raised, and the following will be true: 如果键盘停靠,将引发UIKeyboardWillShowNotification ,并且以下情况将成立:

[[[notification userInfo] valueForKey:@"UIKeyboardFrameChangedByUserInteraction"] intValue] == 1

If a keyboard is undocked, UIKeyboardWillHideNotification will be raised, and the above statement will also be true. 如果键盘未UIKeyboardWillHideNotification将引发UIKeyboardWillHideNotification ,上述语句也将为真。

Using this information has been adequate for me to code my user interface. 使用这些信息足以让我编写用户界面代码。

Note: this might be a violation of Apple's guidelines, I'm not sure. 注意:这可能违反了Apple的指导方针,我不确定。

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

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