-2

I want to Restrict one page in portrait orientation while whole application in both landscape and portrait orientation how to achieve this functionality. I have tried old code from stack over flow but it's not working.

If any one solved such problem then please help me thanks in advance.

  • 1
    What have you tried so far ... add the code which is not working and provide the steps. – Vizllx Feb 17 '16 at 12:07
  • Possible duplicate of [Setting device orientation in Swift iOS](http://stackoverflow.com/questions/25651969/setting-device-orientation-in-swift-ios) – Stefan Feb 17 '16 at 20:36
  • There are DOZENS of SO answers on this... and they should work. – jesses.co.tt Feb 17 '16 at 20:40

1 Answers1

1

Add this snippet to the ViewController which should not rotate:

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

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.Portrait
}
Stefan
  • 5,203
  • 8
  • 27
  • 51