Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splash screen orientation lock

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.

like image 421
vishnu_146 Avatar asked Dec 19 '17 10:12

vishnu_146


People also ask

How do I lock my screen orientation?

If you don't want the screen to switch between portrait and landscape when you move the device, you can lock the screen orientation. To do this, swipe down from the right side of the top panel. Hold the device in the orientation in which you want it locked. On the drop-down menu, touch the “Auto Rotate” button.

How do I force Android to landscape?

When on the main screen, under the orientation section, you will see a number of options like 'Auto-rotate OFF', 'Auto-rotate ON', 'Forced Portrait' and 'Forced Landscape'. As the names suggest, you can use these buttons as one-tap shortcuts to toggle the orientation of your device.


2 Answers

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.

like image 180
Xander43 Avatar answered Sep 30 '22 02:09

Xander43


The only way to lock the splash screen into portrait orientation is if the supported orientations for the app are set to portrait alone.

like image 42
davidethell Avatar answered Sep 30 '22 02:09

davidethell