iOS:旋转iPad,什么阶段改变视图?
我的应用程序对于每个方向都有非常不同的 UI 结构。
我应该在 iPad 旋转生命周期的哪个阶段删除然后添加方向的 UI 以确保最平滑的过渡?
My app has very different UI structures for each orientation.
At what stage in the rotation lifecycle of an iPad should I remove, then add the orientation's UI to ensure the smoothest transition?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
处理自动旋转时,有 4 个主要方法需要关心:
现在,我处理旋转的方式是,例如:
调整
willAnimateRotationToInterfaceOrientation 中的所有帧
;在
willRotateToInterfaceOrientation
中添加/删除子视图(如果需要);在
didRotateFromInterfaceOrientation
中恢复子视图(如果需要)。更一般地说,我修改了
willAnimateRotationToInterfaceOrientation
; 中所有可动画化的属性。而我在willRotateToInterfaceOrientation
/didRotateFromInterfaceOrientation
中进行了所有不可动画的修改。这就是 UIViewController 参考 提到了
willRotate
/didRotate
:When handling autorotation, you have 4 main methods to care about:
Now, the way I handle the rotation is, e.g.:
adjust all the frames in
willAnimateRotationToInterfaceOrientation
;add/remove subviews (if needed) in
willRotateToInterfaceOrientation
;restore subviews (if needed) in
didRotateFromInterfaceOrientation
.More in general, I modify all properties that are animatable in
willAnimateRotationToInterfaceOrientation
; while I do all modifications that are not animatable inwillRotateToInterfaceOrientation
/didRotateFromInterfaceOrientation
.This is what the UIViewController reference says about
willRotate
/didRotate
: