-6

How to disable portrait orientation in swift 3?

 xcode 8 and swift 3
Deepak Tagadiya
  • 2,187
  • 15
  • 28

2 Answers2

4

Try this :

By User Interface enter image description here

Programatically

Add this in appdelegate

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
        return UIInterfaceOrientationMask(rawValue: UIInterfaceOrientationMask.landscape.rawValue)
    }
KKRocks
  • 8,222
  • 1
  • 18
  • 84
2

There is an option in the general tab of your application that will allow you to disable/enable different orientations.

Michaelcode
  • 2,067
  • 3
  • 15
  • 19
  • Strangely, this seems to just not work from Xcode 13 on .... you have to use the code. Strange. – Fattie May 25 '22 at 15:51