Search code examples
iosxcodeipaduiinterfaceorientation

How do I set my ipad to landscape mode before the app loads?


I have a landscape only app and when I test it on the iPad simulator the device starts off in portrait mode and turns to landscape mode once the app loads and messes up the entire layout of my app. How would I make the ipad go into landscape mode before the app loads because its messing up my layout? This is the code Im using in my GameViewController:

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

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    let orientation: UIInterfaceOrientationMask =
        [UIInterfaceOrientationMask.Landscape, UIInterfaceOrientationMask.Landscape]
        return orientation
}

Solution

  • Got it to work I went into my info.plist file and deleted portrait for Supported interface orientations(iPad).