gpt4 book ai didi

ios - UIKeyboardFrameBeginUserInfoKey & UIKeyboardFrameEndUserInfoKey

转载 作者:IT王子 更新时间:2023-10-29 07:41:00 35 4
gpt4 key购买 nike

在管理键盘中 documentation :

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 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.

起始帧结束帧是什么意思?它们有什么区别?

最佳答案

起始帧是键盘在动画开始处的位置:如果显示键盘则在屏幕外,如果键盘隐藏则在屏幕上。结束帧是键盘在动画结束时的位置:反之亦然。您可以利用它们之间的差异编写一个方法来响应隐藏和显示键盘。

在为您的 View 更改设置动画时,还要确保使用 UIKeyboardAnimationCurveUserInfoKeyUIKeyboardAnimationDurationUserInfoKey:这样,您的动画和操作系统的动画将同步。

另一个提示:您链接到的文档指出,“userInfo 字典的 UIKeyboardFrameBeginUserInfoKey 和 UIKeyboardFrameEndUserInfoKey 属性中包含的矩形应该仅用于它包含的大小信息。不要使用矩形的原点(它总是{0.0, 0.0}) 在矩形相交操作中”。至少在 OS 3.2 的 iPad 上,这不是真的。两个矩形具有相同的大小,而屏幕坐标中的原点在两者之间不同。

您可能会发现这个问题有帮助:UIKeyboardBoundsUserInfoKey is deprecated, what to use instead?

关于ios - UIKeyboardFrameBeginUserInfoKey & UIKeyboardFrameEndUserInfoKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3332364/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com