【问题标题】:Landscape iPad shows view in Portrait and then quickly rotates it to Landscape横向 iPad 以纵向显示视图,然后快速将其旋转为横向
【发布时间】:2010-08-10 19:58:35
【问题描述】:

我为 iPad 构建的应用程序有一点问题。我有几个固定在纵向模式下的视图,还有一些可以在纵向或横向模式下工作的视图。一切都很好 - 我有 shouldAutorotateToInterfaceOrientation: 给我正确的结果,并且视图最终会以正确的方向结束。

我说“最终”是因为当我将设备置于横向模式时,我的一些视图会出现这种奇怪的行为,当我切换到它们时,它们会以纵向模式出现并且可见旋转到横向模式。它非常快,但它是可见且令人恼火的。奇怪的是,它只发生在三个视图中的两个中——第三个视图没有这种行为。这是一致的 - 每次我转到“问题”视图时,它们都会给我同样的烦人行为。

还有其他人看过吗?我做错了什么导致这种情况?

【问题讨论】:

  • 如何将视图控制器添加到视图层次结构中?

标签: ipad screen-rotation


【解决方案1】:

您必须在 Info.plist 中设置所有支持的方向

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

【讨论】: