I have an LaunchScreen.storybaord
that shows a logo (textual so it is orientation agnostic). The app starts always in portrait, but it has certain view controllers that allow landscape mode (so making the app portrait only is not an option).
What I want is that the launch screen always comes up in portrait. So holding the phone in landscape during app start should result in seeing the logo rotated (as if looking at a view controller that does not support landscape)
Is there a way to tell the storyboard to be portrait only?
I tried to use size classes traits, but this way I can only address left OR right landscape. Since there is also an intro screen for first time users that animate the logo from launch screen, the logo rotation depends on which direction the phone was put in landscape.
There are several approaches to achieve this. My preferred one though is to specify in Info.plist
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
And override this after app finished launching inside AppDelegate
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return [.allButUpsideDown]
}