dcotter
dcotter

Reputation: 332

shouldAutorotate method not working

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!

Upvotes: 1

Views: 828

Answers (1)

user4476680
user4476680

Reputation:

Have you set the supportedInterfaceOrientations?

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.AllButUpsideDown
}

Upvotes: 0

Related Questions