How to assign default landscape image for iphone in xcode4 - ios

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.

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.

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.

No option to add landscape image in image set

Need to use LaunchScreen with image.I added image set for LaunchScreen image to support iPad/iPhone both.Its working fine.But issue is this that there is no option to add image for landscape orientation.How to add image in imageset for landscape? Any idea? Thanks in advance
Landscape launch images are included in the main launchImage asset. Take a look at this launchImage asset:
You can see there is a space for landscape images, so you have to include them right there.
Depending on the current orientation of the device, the correct launchImage will be displayed.
Say your app supports both portrait and landscape orientations. If the user opens up the app in portrait mode, then the portrait lunchImage will be used. Instead, if the device is set on landscape mode the landscape image, taken from the launchImage asset, will be used.

Orienting iOS splash image to landscape/portrait according to launch orientation

I have an app that can launch in portrait or landscape. I'd like the Default.png file (the splash image that appears when the app launches) to show the image in the correct orientation so I expect I'd need to use two different images (different dimensions). I don't know how to make the app pick which image to use based on its launching orientation, however. Is this possible? Is there any way to know what orientation the app is launching in (before the splash is shown) and then pick the correct image, or do I simply have to settle with either having the image rotated sideways in one of the orientations or having an image that is indistinguishable at 90 degree rotations?
You can name your start up images specifically for the orientation and each one will be displayed for that orientation
Default-Portrait.png
Default-PortraitUpsideDown.png
Default-Landscape.png
Default-LandscapeLeft.png
Default-LandscapeRight.png
See: http://iosdevelopertips.com/ipad/ipad-managing-multiple-launch-images.html
When loading an application on an
iPhone or iPad, a launch image can be
shown to provide feedback to the user
that the application is loading. On
the iPhone one Default.png file was
adequate, with the iPad one needs to
anticipate the device being started in
any orientation, including upside
down.
iPad Launch Image Orientations
To deal with various orientation
options, a new naming convention has
been created for iPad launch images.
The screen size of the iPad is
768×1024, notice in the dimensions
that follow the height takes into
account a 20 pixel status bar.
Filename, Dimensions
Default-Portrait.png * (768w x 1004h)
Default-PortraitUpsideDown.png (768w x 1004h)
Default-Landscape.png ** (1024w x 748h)
Default-LandscapeLeft.png (1024w x 748h)
Default-LandscapeRight.png (1024w x 748h)
Default.png (Not recommended)
If you have not specified a Default-PortraitUpsideDown.png file,
this file will take precedence.
If you have not specified a Default-LandscapeLeft.png or
Default-LandscapeRight.png image file,
this file will take precedence.
Although you can include a Default.png
file, and it will be used if no others
are specified, I would consider it a
best-practice to include all the
relevant images needed by your
application.
See also apple.com: https://developer.apple.com/library/content/qa/qa1588/_index.html, "Provide Launch Images".
Note:
iPhone-only applications:
iPhone-only applications may only have
one launch image.
And: (Apple) Providing Launch Images for Different Orientations, (Apple) Launch Image Type
EDIT 28/06/2014: This answer is from 2011 and as pointed out by #AlexShaffer: "These resolutions listed above are out of date for iOS 7. Launch images for iOS 7 include the status bar area. You should probably also use image catalogs for iOS 7 instead of using images with a naming convention: https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/AddingLaunchImagestoanAssetCatalog/AddingLaunchImagestoanAssetCatalog.html"

Resources