问题描述
在管理键盘文档一个>:
UIKeyboardFrameBeginUserInfoKey包含一个 NSValue 对象的键标识起始帧的CGRect在屏幕坐标中的键盘.这些坐标不考虑考虑应用的任何旋转因子结果到窗口的内容界面方向的变化.因此,您可能需要将矩形到窗口坐标(使用convertRect:fromWindow: 方法)或查看坐标(使用convertRect:fromView: 方法)之前使用它.
UIKeyboardFrameBeginUserInfoKey The key for an NSValue object containing a CGRect that identifies the start frame of the keyboard in screen coordinates. These coordinates do not take into account any rotation factors applied to the window’s contents as a result of interface orientation changes. Thus, you may need to convert the rectangle to window coordinates (using the convertRect:fromWindow: method) or to view coordinates (using the convertRect:fromView: method) before using it.
UIKeyboardFrameEndUserInfoKey 关键对于包含一个 NSValue 对象标识结束帧的CGRect在屏幕坐标中的键盘.这些坐标不考虑考虑应用的任何旋转因子结果到窗口的内容界面方向的变化.因此,您可能需要将矩形到窗口坐标(使用convertRect:fromWindow: 方法)或查看坐标(使用convertRect:fromView: 方法)之前使用它.
UIKeyboardFrameEndUserInfoKey The key for an NSValue object containing a CGRect that identifies the end frame of the keyboard in screen coordinates. These coordinates do not take into account any rotation factors applied to the window’s contents as a result of interface orientation changes. Thus, you may need to convert the rectangle to window coordinates (using the convertRect:fromWindow: method) or to view coordinates (using the convertRect:fromView: method) before using it.
start frame和end frame是什么意思?它们有什么区别?
What is the meaning of start frame and end frame? What is the difference between them?
推荐答案
起始帧是键盘在动画开始的位置:如果键盘正在显示,则在屏幕外,如果键盘正在隐藏,则在屏幕上.结束帧是动画结束时键盘所在的位置:反之亦然.您可以利用它们之间的差异编写一个方法来响应隐藏和显示键盘.
The start frame is where the keyboard is at the beginning of the animation: offscreen if the keyboard is being shown, or onscreen if the keyboard is being hidden. The end frame is where the keyboard will be at the end of the animation: vice versa. You can use the difference between them to write a single method that responds to both hiding and showing the keyboard.
确保在动画视图更改时也使用 UIKeyboardAnimationCurveUserInfoKey 和 UIKeyboardAnimationDurationUserInfoKey:这样,您的动画和操作系统的动画将同步.
Be sure also to use UIKeyboardAnimationCurveUserInfoKey and UIKeyboardAnimationDurationUserInfoKey when animating your view changes: that way, your animations and the OS's animations will be in sync.
另一个提示:您链接到的文档指出,userInfo 字典的 UIKeyboardFrameBeginUserInfoKey 和 UIKeyboardFrameEndUserInfoKey 属性中包含的矩形应仅用于其包含的大小信息.不要使用矩形的原点(始终{0.0, 0.0}) 在矩形相交运算中".至少在 OS 3.2 上的 iPad 上,这是不正确的.两个矩形的大小相同,而屏幕坐标中的原点在两者之间不同.
Another hint: The documentation you linked to states, "The rectangle contained in the UIKeyboardFrameBeginUserInfoKey and UIKeyboardFrameEndUserInfoKey properties of the userInfo dictionary should be used only for the size information it contains. Do not use the origin of the rectangle (which is always {0.0, 0.0}) in rectangle-intersection operations". At least on the iPad on OS 3.2, this is not true. Both rects have the same size, while the origin, which is in screen coordinates, differs between the two.
您可能会发现这个问题很有帮助:UIKeyboardBoundsUserInfoKey is deprecated, what to use?
You may find this question helpful: UIKeyboardBoundsUserInfoKey is deprecated, what to use instead?
这篇关于UIKeyboardFrameBeginUserInfoKey &UIKeyboardFrameEndUserInfoKey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)