繁体   English   中英

iOS:从多任务栏恢复应用程序时,如何保持方向?

[英]iOS: How do I maintain my orientation when resuming the app from the multitask bar?

问题:

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

已知数量:

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

观察到的行为:

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

预期成绩:

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

我知道这是一个古老的职位,但得到的答复是,你是不是定义键UISupportedInterfaceOrientations在Info.plist文件与价值观UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRight

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM