Can I transition between view controllers without

2019-02-21 05:00发布

I have two controllers:

  • MainController, which supports only portrait
  • PhotoController, which supports all orientations.

These are contained in a navigation controller.

This scenario doesn't work well:

  1. The device is physically in landscape mode, with MainController on screen, so the UI is in portrait mode.
  2. We push PhotoController on the navigation stack.
  3. The UI rotates with a rotation animation.

Technically, it works as intended. But the rotation animation is jarring in terms of UX.

I want the transition between view controllers to happen without an animation. I want the system to pretend that the previous controller (MainController) was already in the desired orientation. Is that possible?

Background

The MainController has its own orientation mechanism, without relying on the UIViewController one. So the user thinks that the UI is in landscape mode if the device is phsyically in landscape mode, though UIKit thinks it's in portrait. When transitioning controllers, the rotation animation breaks the illusion I've created, so I need to disable it.

This is on the iPhone, not the iPad.

This question isn't a dupe of Navigation controller custom transition animation because I'm talking about the ROTATION animation between portrait and landscape, not the TRANSITION animation between one view controller and another.

0条回答
登录 后发表回答