iPhone splash screen with LandscapeLeft and LandscapeRight orientations

339 Views Asked by At

I am trying to use UILaunchImages to provide different images for LandScapeLeft and LandScapeRight Orientation's, but only one of them is getting picked up, can anyone please provide the exact naming convention of UILaunchImages for LandScapeLeft and LandScapeRight Orientation, I am looking to provide these images for iPhone, iOS8 and above.

Precisely i am looking for exact size of launch images with proper naming convention for iOS8 onwards, there are older post's that do provide the details of UILaunchImages, but i see that in Apple Human Interface Guideline the image size's have been updated for the most recent update of iOS

I am looking to achieve the landscape splash screen with UILaunchImages Only.

In the info.plist i have set the supported orientation as LandscapeLeft and LandscapeRight only.

I have tested it on iPhone 5c and iPhone 6 plus

enter image description here

According to apple documentation

Naming Your Launch Image Files

The name of each launch image conveys its purpose and how it is used. It is recommended that you use the following format for launch image filenames:

"basename-usage_specific_modifiers.png"

The portion of the filename is the string that you specify using the UILaunchImageFile key. (If you do not specify the key, iOS uses the string Default for the launch image name.) To the base name, you can add several different types of modifiers:

High-resolution image modifier—Use the @2x modifier to identify images that are intended for Retina displays.

Platform-specific modifiers—Use the modifiers ~iphone or ~ipad to specify images targeting a specific size of device.

Orientation-specific modifiers—Use the strings -Landscape, -Portrait, -LandscapeLeft, -LandscapeRight, or -PortraitUpsideDown to specify launch images when the device is in a specific orientation. More specific orientation modifiers take precedence over less-specific orientation modifiers. For example, an image with the -LandscapeLeft modifier takes precedence over an image with the -Landscape modifier when the device is in the correct orientation.

iPhone 5 modifier—Use the string -568h to specify a launch image intended for devices whose screen is 568 points high. Because such devices also have Retina displays, you should also include the @2x modifier in the image name.

URL scheme modifiers—Include the name of your app’s custom URL scheme in launch image names if you want those launch images displayed when your app is launched to open a URL of the specified type. The format of a scheme modifier is - where is your custom scheme name. For example, if your app opens URLs of the form myscheme://example.com, you would include -myscheme in your launch image names.

2

There are 2 best solutions below

1
On

Try this for detecting device orientation,

UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;

if(orientation == 0) //Default orientation 
    //Your image for this Orientation 
else if(orientation == UIInterfaceOrientationPortrait)
    //Set image if the orientation is in Portrait
else if(orientation == UIInterfaceOrientationLandscapeLeft)
    // Set image if Left

else if(orientation == UIInterfaceOrientationLandscapeRight)
    //Set image if right

For more reference visit this link

3
On

You say:

According to apple documentation Naming Your Launch Image Files, the name of each launch image conveys its purpose and how it is used

But what you are not understanding is that that document is very old, and that the naming convention is obeyed only if you are using a single launch image entry in the Info.plist. That is not what you are doing. You are using a Launch Images array in your Info.plist. Therefore the names of your launch images are completely arbitrary; only the UILaunchImageOrientation of each launch image in the array tells the system what to use at launch time. In fact, in that case you must not use the naming conventions from that earlier document.

You will want to read this document:

https://developer.apple.com/library/content/technotes/tn2244/_index.html

And this one:

https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW28

Note in particular the sentence:

The name you specify for this key [i.e. UILaunchImageName] should not include a filename extension, nor should it include modifiers such as @2x, -568h, ~iphone, or ~ipad.

[Emphasis mine.]