0

I have a navigation stack in which all view controllers are in portrait except one view controller which I have to push in landscape.

I would like to push the view controller in landscape orientation with a custom animation however if I try to push the landscape view controller on the same navigation stack, iOS also gives a rotation animation which I want to disable.

So the question is, how do I disable the default rotation animation when pushing a view controller in landscape orientation and also have a custom animation added while pushing ?

user2990765
  • 387
  • 2
  • 3
  • 16
  • You'll want to start with `UINavigationControllerDelegate`. Check out the [documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationControllerDelegate_Protocol/#//apple_ref/occ/intfm/UINavigationControllerDelegate/navigationController:animationControllerForOperation:fromViewController:toViewController:) for `animationControllerForOperation(operation:fromViewController:toViewController)` – Brendon Roberto Apr 25 '16 at 18:25
  • @brebory I did use it to do my custom animation but i'm not sure how to disable the default rotation animation at the same time. – user2990765 Apr 25 '16 at 18:28
  • Take a look at this answer, it might provide some guidance: http://stackoverflow.com/a/34148649/3487310 – fsb Apr 25 '16 at 20:41
  • @fbara, In the above answer, he is initially pushing the view controller in portrait orientation and on rotation of device, the view animates to landscape. In my case, I would like to push the view controller in landscape orientation with my own custom animation. – user2990765 Apr 25 '16 at 22:27
  • True, but he was also disabling the autorotation which is part of what I thought you were looking for. Disable the autorotation and have your own animation in its place. Sorry if I misunderstood what you wanted. – fsb Apr 26 '16 at 13:18

0 Answers0