Can I transition between view controllers without a rotation animation?

荒凉一梦 提交于 2019-12-19 11:45:12

问题


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.

来源:https://stackoverflow.com/questions/42743526/can-i-transition-between-view-controllers-without-a-rotation-animation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!