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:
- The device is physically in landscape mode, with MainController on screen, so the UI is in portrait mode.
- We push PhotoController on the navigation stack.
- 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.
来源:https://stackoverflow.com/questions/42743526/can-i-transition-between-view-controllers-without-a-rotation-animation