1

I have used the following code from these questions to disable the rotation animation. It works for for iPhone devices but does not work for iPads.

The view controller in question is the root view controller of a navigation controller that is being presented modally.

Does anyone know why the following method would work on an iPhone but not an iPad?

 override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {

    coordinator.animate(alongsideTransition: nil) { _ in UIView.setAnimationsEnabled(true) }

    UIView.setAnimationsEnabled(false)

    super.viewWillTransition(to: size, with: coordinator)
}

StackOverflow Questions

Disable orientation change rotation animation

In 7.3/9/2+ Swift how to disable rotation animation, when device rotates?

Community
  • 1
  • 1
Peter Hornsby
  • 4,208
  • 1
  • 25
  • 44

2 Answers2

1

From my testing it appears that you can disable the rotation animation for iPhones but when it comes to the iPad the animation is handled by the system and there is no possibility to interact with it.

So I would conclude that you cannot disable the rotation animation on an iPad given the current public api's.

Peter Hornsby
  • 4,208
  • 1
  • 25
  • 44
0

it could not work because size of screen is not changed on rotation of ipad (or changing not significantly). I've had a problem with this method once i turned off portrait orientation of one screen. My fix was to catch device orientation by observing for a notification. But in this case you will have only "did rotate" state.