Launch screen not working properly - ios

My application supports both orientation landscape and portrait and here i am using launch screen for splash screen then dragged uiimageview and pined trail, lead, bottom, top...what are all the sizes required to add? should i use image assets? Do i have to create two different image? I am using two different image for iPhone and iPad by using size class, Its stretching when iPad runs on landscape mode.
I am referring this https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/launch-screen/
Here how to set image for landscape and portrait and sizes?
We know how to use launch image using asset catalog.
For iPhoneX design gets collapsed, many people suggested us to use launch screen storyboard, then iPhoneX issue went away..
Thanks in advance...

Here is good Apple document answering your question: Launching your iPhone Application in Landscape
Very concise, this document says
Set launch image for either Portrait mode or Landscape mode. Choose orientation of launch image according to your requirement for Application Launch. Do not use static launch image, if your application supports both orientation.
Launch Images
Launch images for iPhone apps are always sized to match the dimensions of the screen in portrait orientation. For applications that launch into landscape orientation, you should use your preferred graphics editing software to rotate the content of the launch image while keeping the image's size consistent with a portrait launch image (height > width).
Avoid using asset catalogs to manage the launch images of landscape applications.
Except for launch images used by the iPhone 6 Plus, asset catalogs assume that all iPhone launch images are for the portrait orientation. When your application is compiled, entries for each launch image are added to the compiled information property list under the UILaunchImages key. The value for the UILaunchImageOrientation key in each of these entries is always Portrait. These entries are then ignored at launch time because the value of Portrait for the UILaunchImageOrientation key does not match the launch orientation (Landscape Left or Landscape Right). The result is a blank screen during launch as the system cannot find an appropriate launch image.
Instead, you should use a Launch File if your application only supports iOS 8 and above. Otherwise, you will need to add your launch images as resources to your project and then add the UILaunchImages key to your application's information property list. Be sure to disable use of the asset catalog for managing the launch images by selecting 'Don't use asset catalogs' from the Launch Image Source menu under the General tab of the project editor for your applications' target.
It’s best to use an Xcode storyboard for your launch screen, but you can provide a set of static images if necessary. Create static images in different sizes for different devices, and be sure to include the status bar region.
Static Launch Screen Images
Here is dimension table for static launch screen image for both orientations:
How to set landscape static image?
Enable Landscape launch screen image support from your image assets
(Image) Assets.xcassets >> Launch Image >> Attribute Inspector >> Enable Landscape (tickmark) >> Set Landscape images
Here is nice tutorial for the same: Customizing LaunchScreen.storyboard

Set image with size of 1125 × 2436 for iPhone X.

Related

Launch Screen Storyboard

As LaunchScreen I want to have an exact image of the start page that appears right after the launch.
Therefore, I made screenshots of all resolutions of the start page, both portrait and landscape. Then I removed all fonts because I generate two variants of the app in different languages and the texts (e.g. in the buttons) are different. The launch screens should fit both variants.
In Images.xcassets I added LaunchImage and assigned all positions with the correct resolutions (for both, iPhone and iPad).
LaunchScreen.storyboard has an ImageView in the ViewController with the image name LaunchImage.
Result:
1 All launch images displayed are scaled even though the correct resolutions are available.
Only the portrait images are used, also for landscape, and therefore scaled and distorted.
on iPads only iPhone images are displayed, portrait version also in landscape, scaled accordingly.
On some devices (e.g. iPhone X), only a white or black screen is displayed at launch (portrait and landscape).
Under no circumstances will the correct launch screen be displayed.
On the image you see all relevant areas and the list of all used launch images.
What did I do wrong or miss?
Supplement:
I just followed another tip and deactivated "Clears Graphic Context" in UIImageView and changed the display to "Aspect Fit".
Result: The portrait launch image is still used in the iPad, but is no longer scaled and is now centered.
So the most important question now is why an iPhone portrait launch image is used for iPad in both directions.
If you are using a LaunchImage, you should set that image in the Target settings. Go to your target and under the General tab, set the Launch Images Source value to the image you have in your asset catalog:
Also delete the text LaunchScreen in the Launch Screen File field.

Lock LaunchScreen.xib orientation on iPhone 6 Plus

I am using a LaunchScreen.xib to start my app. This xib must works in portrait mode (only!). Anyone knows how can I achieve that with an iPhone 6/6s Plus (they can start the app in landscape)?
I believe if you open the Attributes Inspector for the assets catalog then you need check the landscape box like image
Hope my solution help you to resolved your issue.
From the Documentation:
Launch Images
Launch images for iPhone apps are always sized to match the dimensions
of the screen in portrait orientation. For applications that launch
into landscape orientation, you should use your preferred graphics
editing software to rotate the content of the launch image while
keeping the image's size consistent with a portrait launch image
(height > width).
Avoid using asset catalogs to manage the launch images of landscape
applications. Except for launch images used by the iPhone 6 Plus,
asset catalogs assume that all iPhone launch images are for the
portrait orientation. When your application is compiled, entries for
each launch image are added to the compiled information property list
under the UILaunchImages key. The value for the
UILaunchImageOrientation key in each of these entries is always
Portrait. These entries are then ignored at launch time because the
value of Portrait for the UILaunchImageOrientation key does not match
the launch orientation (Landscape Left or Landscape Right). The result
is a blank screen during launch as the system cannot find an
appropriate launch image.
Instead, you should use a Launch File if your application only
supports iOS 8 and above. Otherwise, you will need to add your launch
images as resources to your project and then add the UILaunchImages
key to your application's information property list. Be sure to
disable use of the asset catalog for managing the launch images by
selecting 'Don't use asset catalogs' from the Launch Image Source menu
under the General tab of the project editor for your applications'
target.
For more info:
If you are not using assets, use UILaunchImages key to make changes to the launchscreenimage in your application's information property list and then edit the value under each UILaunchImageName key to match the corresponding image from your project. Do not include the extension or any modifiers (#2x, #3x). You can edit your information property list by control+clicking on it in the File Navigator and choosing Open As > Source Code from the popup menu.

Launch screen.storyboard for Portrait and Landscape vs split screen

I have to implement split screen functionality for the new iPad and I got a workaround from Apple's doc to support the same in my app: https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/QuickStartForSlideOverAndSplitView.html#//apple_ref/doc/uid/TP40015145-CH13-SW1
In this doc, check the 2nd point:
Provide a LaunchScreen.storyboard file (instead of a .png image file
as you did in iOS 7 and earlier)
This is why I have to use Launch screen.storyboard. Now, the split over works perfect but for my app I have separate Launch screens, Default-Portrait and Default-Landscape. But now I have taken storyboard, I am unable to customise launch screens for different orientations. And even I can't code for the same in Launch screen or it gives me error.
Further, I have tried using size classes to provide separate imageviews for both orientations but I got no success.
It would be great help if anyone suggests me how to implement Launch screen.storyboard for Landscape and Portrait with different images.
You can add a UIImage to your launch screen. Once you've done that and set the constraints to fill the width and height then add an image to your asset catalogue.
On the properties of the image within the catalogue set the 'width class' and 'height class' to 'Any & compact'. Then you'll have spaces for images for Any and compact height (landscape) and Any and compact width (portrait). The just put your artwork in to the appropriate artwork placeholders and use that image on your storyboard.
I believe that will then choose the appropriate artwork for you depending on how the device is held when the app launches.

Supporting iPhone 6 and iPhone 6+ with different launch/splash screen image for iPad Portrait and Landscape orientations

What I understood from the available documentation and my testing is that
All existing Apps on iPhone 6 and 6 Plus run in compatibility mode,
which means the APIs (like [UIScreen mainScreen].bounds) will
return 320x568 (iPhone 5/5s) still in new iPhones (6/6 Plus) and
all UI is scaled to the correct resolution by iOS.
To support iPhone 6/6Plus we need to create xib for Launch Screen
(File->New->File->UserInterace->Launch Screen) and set the nib file
as "Launch Screen File".
We can set different images for launch screen inside Launch screen nib file based
on avaialble size classes. [Basically combinations of Any, regular
and compact]
There is no way to differentiate between iPad in portrait and iPad
in Landscape orientation (both are regular width regular height).
Also there no way to differentiate between iPhone 4/4s and iPhone
5/s.
Is there a way I can support iPhone 6/6 Plus mode and also provide different launch images for iPad in portrait and iPad in landscape orientation?
See also the similar problem here iOS 8 size classes for iPad landscape
You don´t have to use the launch screen file to make your App iPhone 6 / 6+ resolution compatible. Instead, you can select the LaunchImage asset as your Launch Images Source.
It can be found at "App Icons and Launch Images" under your Targets:
If there is no LaunchImage asset just go to your Images.xcassets, make a secondary click (right click) and select "New Launch Image":
The result is something like that:
Now just drag and drop your images for the specific resolutions you want to support and set the created LaunchImage asset as your source.
Hope it helps
Cheers
Asset catalogues currently work in landscape mode on iPhone on ios8. I had this reponse from apple support:
"There is a bug involving launch images in asset catalogs and apps
that launch in landscape on iPhone. Behind the scenes, the asset
catalog compiler generates the same UILaunchImages key [1] in the
final Info.plist that you would have added when you were specifying
launch images manually. One of the sub-keys for each launch image
specified under the UILaunchImages key is UILaunchImageOrientation
which is always set to Portrait by the asset catalog compiler. This
makes sense because apps on iPhone always launch in portrait
orientation [2]. However, the iOS app launcher decides that since
your UISupportedInterfaceOrientations only contains
UIInterfaceOrientationLandscapeLeft and
UIInterfaceOrientationLandscapeRight, it will only look for landscape
launch images under the UILaunchImages key, of which it finds none.
Since there is no way to force the assets catalog compiler to specify
Landscape for the UILaunchImageOrientation sub-key of iPhone
launch images, you should continue to specify your launch images by
editing the information property list for your app as before."

How to assign default landscape image for iphone in xcode4

I have created a universal app and I want to display a default image. I assigned all images to the properties we can set in xcode4. But I did not get any property where I can set iphone landscape image. and even where to set iphone-retina landscape image. I searched on web and i found that I should append -landscape to default image. I did that but does not worked. can anyone tell me how to do this?
You can only have a single default image for iPhone per resolution. Currently that's one for retina and one for older screens. This image must always be portrait even if your app launches in landscape only in which case you would create a landscape default image and rotate it 90 degrees to be portrait.
According to the documentation http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/BuildTimeConfiguration/BuildTimeConfiguration.html:
In iOS 3.2 and later, an iPad application can provide both landscape and portrait versions of its launch images. Each orientation-specific launch image must include a special modifier string in its filename. The format for orientation-specific launch image filenames is as follows:
<basename><orientation_modifier><scale_modifier><device_modifier>.png
E.g. setting the image for landscape left: -LandscapeLeft: Specifies a left-oriented landscape version of the launch image. A file with this modifier takes precedence over a file with the -Landscape modifier for this specific orientation.

Resources