问题:
如果我在UIInterfaceOrientationLandscapeRight方向上将应用程序发送到后台,当我从多任务栏恢复应用程序时,方向是UIInterfaceOrientationLandscapeLeft,这是默认情况下显示的快照和视图 . 视图通过在被挂起之前旋转回最后已知的方向,UIInterfaceOrientationLandscapeRight,立即重新定位自身 .
已知数量:
-
App支持2个InterfaceOrientations:UIInterfaceOrientationLandscapeLeft和UIInterfaceOrientationLandscapeRight
-
App利用自动旋转覆盖ShouldAutoRotateToInterfaceOrientation的所有视图控制器,如果方向是支持的方向,则返回yes
-
两个方向都在UISupportedInterfaceOrientations键下的Info.plist中定义
-
当应用程序发送到后台时,将拍摄自动快照并存储支持的方向
-
从跳板恢复应用程序按预期工作,方向与发送到后台的方向相同 .
观察到的行为:
从多任务栏恢复应用程序时,应用程序会收到2个方向通知,这些通知分别由重写的shouldAutoRotateToInterfaceOrientation进行评估 . 首先是UIInterfaceOrientationLandscapeLeft,然后是UIInterfaceOrientationLandscapeRight .
预期成果:
从多任务栏恢复应用程序时,方向与暂停时的方向相同 . 因此,如果我们处于UIInterfaceOrientationLandscapeRight模式,那么我希望以相同的方向恢复 .
1 回答
我知道这是一篇旧帖子,但答案是你没有在Info.plist文件中使用值
UIInterfaceOrientationLandscapeLeft
和UIInterfaceOrientationLandscapeRight
定义键UISupportedInterfaceOrientations
.