UIKeyboardFrameBeginUserInfoKey/UIKeyboardFrameEndUserInfoKey: what is the difference?

隐身守侯 提交于 2019-12-11 17:47:47

问题


It is possible to read the following in the apple Documentation:

UIKeyboardFrameBeginUserInfoKey The key for an NSValue object containing a CGRect that identifies the start frame of the keyboard ……

UIKeyboardFrameEndUserInfoKey The key for an NSValue object containing a CGRect that identifies the end frame of the keyboard ……

Would that mean that the keyboard has a "start frame" and an "end frame"? I suppose YES.

But when the keyboard appears I cannot see any frame changing. It just stays the same frome start to end.

So my question is: What are those "start frame" and "end frame" referring to? I must be missing something.

Thanks for your help.


回答1:


The keyboard does indeed have a start and end frame, and the properties do exactly what you suppose they do. They keyboard does not always animate however; sometimes it just appears or changes size. For example, in the case that you are typing on the Japanese keyboard, when the keyboardWillShow fires after the first character is hit. There's no animation, but an additional bar appears above the keyboard, thus changing the size. The properties you listed above tell you how much the keyboard changed size by.

I'm not sure what exactly you're looking at when you say no frames are changing. I suppose it's possible that when you move from one editable text field to another, you get a keyboardWillShow notification, even though nothing on the screen changes.



来源:https://stackoverflow.com/questions/10458870/uikeyboardframebeginuserinfokey-uikeyboardframeenduserinfokey-what-is-the-diffe

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