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

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."

Related

Launch screen not working properly

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.

Launch screen storyboard for multiple devices and different orientations in iOS

My application supports all devices from 4 inch onwards in both orientations.
iPhone - 5, 5S, 5C, 6, 6S, 6+, 6S+, SE
iPad 4, iPad Air, iPad Air2, iPad Pro etc
Using asset catalog for launch screen its working fine but in iPad Pro app displays standard keyboard rather iPad Pro optimized keyboard which is bigger and doesn't give best user feel.
As per below link app should be using launch storyboard rather than asset images to get optimized iPad Pro native keyboard.
https://forums.developer.apple.com/thread/26357
Now question is how to support both orientations during launch screen storyboard ?
How to add different launch images for portrait and landscape modes in storyboard ? Using size class for iPad in both orientations its both Regular and Regular size.
Note - Because it launches a screen storyboard, one can't customize the size class with custom class.
In your launchsScreen.storyboard add imageView and set it's four constraints like : top,bottom,leading,trailing.
Now, in your assets add separate images for iPhone and iPad with 1x,2x,3x resolution for iPhone and 1x,2x for iPad.
And set that image to that imageview. It will manage then for every device!
You can set different images for different size class in assets. So for different orientation you can set different images in assets.
refer Apple documentation for more details.
And yes you can use vector graphics as suggested in comment by #pkc456 to keep your app light weight.

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.

#3x images incorrectly used on iPhone 6 or 5S or 5 in XIB's with the "Use as Launch Image" option set

With-in a clean brand new iOS project I've:
added 2 images to the project "background#2x.png" and "background#3x.png"
added a XIB named "LaunchScreen.xib"
checked the XIB's "Use as Launch Screen" option
added a UIView sub-view to LaunchScreen.xib and set its image name to "background.png"
with-in the project settings, under the targets 'General' settings I've set the 'Launch Screen file' to "LaunchScreen"
Now when I launch the app on any of the devices list below the #3x image is displayed in the resulting launch screen when surely the #2x image should be used.
Problem devices (that all use the #3x resource):
iPhone 5 (iOS 8.0.0)
iPhone 6 (iOS 8.0.0)
iPhone 6 (iOS 8.0.2)
iPhone 5 Simulator (iOS 8.0.0)
iPhone 6 Simulator (iOS 8.0.0)
NOTE that the #2x image is distinctive from the #3x image so I can easily identify which one is being used.
At first I assumed this was a bug with the simulator and was staggered when it occurred on a real device also.
I assume this is yet another iOS8 bug however I guess there's also the possibility that its expected behaviour as the result of the launch screen being cached as a static image of some kind.
Any ideas or potential solutions?
EDIT:
For the benefit of others, I have subsequently found that if the images are instead added to an Images.xcassets image set then the correct behaviour is in-fact observed. HOWEVER this is not an ideal solution for us since we have a very specific image export process which means we are not using an Images.xcassets in out project (there are thousands of images in the app).
I have now also raised a Radar with Apple #18513968
http://openradar.appspot.com/18513968
I've just tried this myself, and get the same behaviour you have mentioned.
By setting the Launch Images Source to "Use Asset Catalog", and adding the Launch Image you can get each device to show its specific background. Some screenshots can be seen here:
Supporting iPhone 6 and iPhone 6+ with different launch/splash screen image for iPad Portrait and Landscape orientations
Looking into it a bit more, I found a website that mention:
http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/
"You can use the new adaptive UI features in Interface Builder to fit your layout to different screen sizes. If your scene requires screen-size-specific images, use asset catalogs to define different images per size class."
Maybe that is the only way to do it.

iPad required launch images

I'm developing a universal iOS app that only supports portrait and upside-down interface orientations. When supplying the launch images in Xcode, I see that I have warnings for landscape orientations, even having only portrait and upside down enabled in device orientations settings. Does this mean that I need to supply landscape launch images anyway? I don't find this clear in Apple's documentation.
Thanks
No. These are warnings. Apple would prefer you support all orientations on iPad, and recommend you do, but they do not require it. (Yet)
Launch Images in Landscape Orientation is optional and xCode ignores it if it is not provided in Application.
However, If you are using Xcode5 there will be a folder named Images.xcassets > Launch Images > There will be a blank icon available for iPad Landscape > Right Click on those 1x and 2x icon > Remove Selected Items.
This will remove the warnings that you are having in your case.
Let me know if that helps.
an iPad app includes at least one launch image in portrait
orientation and at least one launch image in landscape orientation.

Resources