开发者

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

Issue:

If I send the app to the background when in UIInterfaceOrientationLandscapeRight orientation, when I resume the application from the multi-taskbar the orientation is UIInterfaceOrientationLandscapeLeft which is the default, for both the snapshot and view displayed. The view immediately re-orients itself by rotating back to the last known orientation before being suspended, UIInterfaceOrientationLandscapeRight.

Known Quantities:

  1. App supports 2 InterfaceOrientations: UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight
  2. App utilizes auto-rotation all view controllers overriding ShouldAutoRotateToInterfaceOrientation, returning yes if the orientation is either of those supported
  3. Both orientations are defined within the Info.plist under the UISupportedInterfaceOrientations key
  4. When the app is sent to the background the automatic snapshot is taken and stored for the supported orientations
  5. Resuming the app from the springboard works as expected, the orientation is the same as when it was sent to the backg开发者_运维问答round.

Observed Behavior:

When resuming the app from the multi-taskbar, the app receives 2 orientation notifications which are respectively evaluated by the overridden shouldAutoRotateToInterfaceOrientation. First UIInterfaceOrientationLandscapeLeft, then UIInterfaceOrientationLandscapeRight.

Expected Results:

When resuming the app from the multi-taskbar, the orientation is the same as when it was suspended. So if we were in the UIInterfaceOrientationLandscapeRight mode, then I'd expect to resume with the same orientation.


I know this is an old post, but the answer is that you are not defining the key UISupportedInterfaceOrientations in your Info.plist file with the values UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜