Lock LaunchScreen.xib orientation on iPhone 6 Plus - ios

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.

Related

For iOS LaunchImage, do I need all images?

If using launch image asset do I need to specify all the images if my app is only in portrait mode and only for iPhone? I.e. do I need the landscape images or the iPad images or will it work without them?
If your app is only in portrait mode and only for iPhone, then no you don't.
I would suggest using Storyboards instead of launch images. Here is how you could do so:
This is how:
Create a blank storyboard file named for example MyLaunchScreen.storyboard.
Click on your project and go to your Target Settings and, on the General tab, select the storyboard as your Launch Screen File. Xcode will then add a corresponding UILaunchStoryboardName key to your app’s Info.plist. When this key is present, Xcode will prioritize it over any launch images you might have set.
Add a view controller scene to the storyboard, add UIImageViews or whatever you like. Adding some constraints will make this storyboard work on all devices without having to set images for all devices.
If you still do want to use images, here is how:
a. Click on the project target, in the General tab, set the Launch images source to be an image asset
b. In the launchImage image set, toggle the attributes inspector and set the device classes that you'd like to add launch images for. In your case just the iPhone portrait checkbox should be selected:
You can specify which images you'll add, it should reflect the project settings device support. So no, you don't all the images. And be careful with the retina and retina HD support, your layout could be down-scaled.

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.

Xcode: use LaunchImagesSource instead of LaunchScreenFile

I was previously using a single Launch Screen File, but I would now like to switch to the Launch Images Source, where I can defined the launch screen files for all devices.
I have defined the LaunchImage set, and I have left Launch Screen File blank.
However when I run the app on my iPad Mini 3, I still don't get the image I defined for the iPads.
Should I set some other values?
Confirm in your project's Info.plist that there isn't an entry for
Launch screen interface file base name
UILaunchStoryboardName
In some cases, changing from a launch screen file to xcassets fails to remove this value.
I have the same values for the App Icons and Launch Images section.
Then, the way I have setup the LaunchImage on the sidebar has both iPad portrait and landscape selected:
And have added the 4 necessary files to comply with that configuration:

LaunchScreen.xib single image for all devices?

I'm using the current Xcode and targeting iOS 8.
I'm wondering if it's okay if in my LaunchScreen.xib I put a single imageView that is constrained to all sides of the parent container. Within that image view will be my splash image called: splash.png;
Now here's the kicker, this splash.png will be hi-res and all devices (iPhone/iPad) will use this one image. Is this ok according to apple's guidelines? (note: it's okay with me) I don't mind if it stretches to fit). Also note my app's only in portrait.
Yes. It's fine, that's because they introduced this new feature (launchscreen.xib).
For deployment targets prior to iOS 8, you add a set of launch images to an asset
catalog for each of the possible screen sizes.
New projects are created with a launch screen file called
LaunchScreen.xib. Alternately, you can create a new launch screen file
using File > New, selecting the User Interface category, and choosing
a file type of Launch Screen. The launch screen uses size classes to
adapt to different screen sizes and orientations, see Adapt to Multiple iOS Screen Sizes and Orientations with Size Classes for more
information.
Reference : Create and Set the iOS Launch Images or Launch Screen File

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

Resources