1

In my swift project i have all my viewcontroller to only portrait and i want only 1 view controller to be only landscape

My settings here

OuSS
  • 13
  • 1
  • 5

1 Answers1

1

To do this , you have to set the Settings for both portrait and landscape and all the following code in each view controller except in which you want a landscape view

override func shouldAutorotate() -> Bool {
    return false
}

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

For further help check here

Community
  • 1
  • 1
Sucharu Hasija
  • 1,096
  • 11
  • 23
  • shouldAutorotate and supportedInterfaceOrientations are not fired :( – OuSS May 10 '16 at 14:36
  • Check out this one. http://stackoverflow.com/questions/32535329/shouldautorotate-not-called-on-view-controller – Sucharu Hasija May 10 '16 at 15:29
  • I read post that i need to add extension of UINavigationController that override shouldAutorotate and supportedInterfaceOrientations, and it work for the first viewcontroller after navigation but others no – OuSS May 10 '16 at 16:06