1

I'm a little confused about the auto rotation methods in iOS. I'm using Swift for my app, which contains a tab bar controller and a nav bar controller.

The issue is I want all view controllers to be locked in Portrait mode except for one view controller which shows an image. I want this view controller to be able to be seen in both Portrait or in Landscape orientation based on how the user wants to view the image.

If I turn off the left/right rotation in the deployment info settings and call the shouldAutorotate() - return true method then the view controller with the image stays locked and won't rotate.

If I turn on the left/right rotation in deployment info settings and call the shouldAutorotate() - return false in the view controllers that I want locked then they still auto rotate.

-I feel like this shouldn't be as difficult as it is and can't find a solid answer on this. I'm a little newer to app development so any advice suggestions are appreciated.

Thanks in advance!

dcotter
  • 312
  • 6
  • 22
  • Did my solution work for you? – FredLoh Dec 01 '15 at 23:07
  • Sorry for the late response. It did not. From what I've been reading when the view controller is embedded in a tab bar or nav controller it can become a problem because the nav bar/tab bar's orientation settings have precedence over its child view controllers. – dcotter Dec 02 '15 at 04:57

1 Answers1

0

Have you set the supportedInterfaceOrientations?

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.AllButUpsideDown
}
FredLoh
  • 1,804
  • 18
  • 27