Search code examples
iosuistoryboard

How do I make sure that two screens only support Portrait mode?


So, in an application that I am working on, I had to create 2 view controllers, one that would support the iPad layouts, and one that would support the iPhone layouts. However, my storyboards can't support landscape mode.

my deployment info: https://i.sstatic.net/LoNJM.jpg

part of what my info.plist looks like: https://i.sstatic.net/GRgku.jpg

Notice that I have iPadStoryboard.storyboard for the version that runs on iPads and Main.storyboard for the version that runs on iPhones.

The phone does what I want it to – it doesn't turn into a landscape orientation.

However, the iPad doesn't do the same thing. How do I fix that?


Solution

  • If it's only for one or two screens , Try this in your controller file

    override var shouldAutorotate: Bool {
        return false
    }
    override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
        return .portrait
    }