Can we have the orientation locked for splash screen in potrait for the app that supports all orientations?Currenly when I launch the app while device is landscape makes the splash screen looking really ugly,and I need it only in portrait.
12
votes
is the splash screen implemented with storyboard? if so, you just need to fix the constraints
- Andrea Mugnaini
But I dont need the splash in landscape.I assume correcting constraints wont do any good for that..
- vishnu_146
Since your app is supporting all the orientations, you have to adhere to that. What does the splash contain?
- Andrea Mugnaini
Just some UIImageviews and UILabels
- vishnu_146
Found another solution, Just set the orientations to portrait in info.plist and return the required orientations from the Appdelegate in the supported interface orientations for the window, I suspect the order of execution is playing here.
- vishnu_146
2 Answers
12
votes
If you would like to use a launch screen storyboard in a single orientation, change the info.plist to specify that orientation only.
Then if you would like to have the app run different orientations after the launch screen storyboard has finished, then simply add the following method to your app delegate (objective-c):
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
UIInterfaceOrientationMask theMaskToReturn = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | "etcetera";
return theMaskToReturn;
}
Then use a single navigation controller for your entire app (and if you subclass this single navigation controller it must have the same masktoreturn as above).
Then in each VC you can specify the supported orientations.
Note that if you are sharing via MFMailComposer or an ActivityVC which are both presented from self in a VC, then the masktoreturn must include the permissible orientations.