2

问题:

如果我在 UIInterfaceOrientationLandscapeRight 方向时将应用程序发送到后台,当我从多任务栏恢复应用程序时,方向是 UIInterfaceOrientationLandscapeLeft,这是默认的,用于显示的快照和视图。视图立即通过旋转回到暂停前的最后一个已知方向 UIInterfaceOrientationLandscapeRight 来重新定位自身。

已知数量:

  1. 应用程序支持 2 个界面方向:UIInterfaceOrientationLandscapeLeft 和 UIInterfaceOrientationLandscapeRight
  2. 应用程序利用自动旋转所有视图控制器覆盖 ShouldAutoRotateToInterfaceOrientation,如果方向是支持的方向之一,则返回 yes
  3. 两个方向都在 UISupportedInterfaceOrientations 键下的 Info.plist 中定义
  4. 当应用程序被发送到后台时,会拍摄并存储支持的方向的自动快照
  5. 从跳板恢复应用程序按预期工作,方向与发送到后台时相同。

观察到的行为:

当从多任务栏恢复应用程序时,应用程序会收到 2 个方向通知,这些通知分别由覆盖的 shouldAutoRotateToInterfaceOrientation 评估。首先是 UIInterfaceOrientationLandscapeLeft,然后是 UIInterfaceOrientationLandscapeRight。

预期成绩:

从多任务栏恢复应用程序时,方向与暂停时相同。因此,如果我们处于 UIInterfaceOrientationLandscapeRight 模式,那么我希望以相同的方向恢复。

4

1 回答 1

0

我知道这是一篇旧文章,但答案是您没有UISupportedInterfaceOrientations在 Info.plist 文件中使用值UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRight.

于 2011-10-16T21:51:40.227 回答