【发布时间】:2014-09-26 23:53:37
【问题描述】:
谁能告诉我在 iOS 8 中使用纵向和横向界面方向的“正确”或“最佳”方法?似乎我想为此目的使用的所有功能在 iOS 8 中都已弃用,而且我的研究没有找到明确、优雅的替代方案。我真的应该查看宽度和高度来自己确定我们是处于纵向还是横向模式吗?
例如,在我的视图控制器中,我应该如何实现以下伪代码?
if we are rotating from portrait to landscape then
do portrait things
else if we are rotating from landscape to portrait then
do landscape things
【问题讨论】:
-
阅读
UIViewController的文档。请参阅标题为“处理视图旋转”的部分。它解释了您应该做什么。 -
它们已被弃用是一个线索。您必须使用其他东西....其他东西应该是 AutoLayout 和 Size Classes :-)
标签: ios ios8 orientation uiinterfaceorientation landscape-portrait