iPhone & iPad Apps Launch Images - iphone

Preamble: This is intended to be be a canonical question (and answer) on iOS Apps launch images (aka Default.png).
Questions
What is the best way to set the Default.png; Manually in the Info.plist or using Xcode (supported in xcode-4 only, I think)
Does the iPhone auto-rotate the Default.png depending on the device orientation?
What effect does the UIInterfaceOrientation (Initial interface orientation) key in the Info.plist have?
Does UISupportedInterfaceOrientations and UISupportedInterfaceOrientations~ipad have any effect on displaying the Default.png
Can I set different Default.png for the iPad using these file names?:
Default-Portrait.png
Default-PortraitUpsideDown.png
Default-Landscape.png
Default-LandscapeLeft.png
Default-LandscapeRight.png
Are there iPhone equivalents (see 3)
Is there any Apple documentation that covers all aspects of "Launch Images"? If so, where?
NB: It seems the usage of launch
images changes quite frequently
between SDK releases, please indicate
in your answers what version you are
talking about

5) Is there any Apple documentation that covers all aspects of "Launch Images"? If so, where?
There's something here:
Supply a launch image to improve user experience.
Avoid using it as an opportunity to
provide:
An “application entry experience,” such as a splash screen
An About window
Branding elements, unless they are a static part of your application’s
first screen

Partial answers based on latest iPhone iOS
Manually in the Info.plist or using Xcode (supported in xcode-4 only, I think)
These two methods are equivalent. Xcode merely presents a convenience editor UI for the info.plist. There is no other way to specify the launch image (available to 3rd party developers) than setting it in info.plist.
Does the iPhone auto-rotate the Default.png depending on the device orientation?
No. but as Springoard does not support upside down, it is unlikely that any portrait apps are launched upside down.
What effect does the UIInterfaceOrientation (Initial interface orientation) key in the Info.plist have?
None
Does UISupportedInterfaceOrientations and UISupportedInterfaceOrientations~ipad have any effect on displaying the Default.png
No.

In my experience, the simplest approach with the easiest maintenance is to simply follow Apple's conventions when naming your launch image files. If you carefully read and follow those naming conventions, everything else becomes automatic. Automated features include:
Choosing different launch image files for different device screens.
Handling the new taller screen found on current iPhone 5/5S & iPod touch.
Handling Retina screens.
Handling device orientation (Portrait vs Landscape) on iPad. (handhelds have only Portrait)
Displaying thumbnails in Xcode 4
If you:
Create image files with the correct resolution (carefully read the doc, as resolutions are not what you might expect)
Follow the naming rules documented by Apple
Place the files at the top level of your app bundle†
…then:
Thumbnails of the images will automatically appear within project settings of Xcode 4.
Your launch images will automatically be used on devices as well as the iOS Simulator.
By following the naming conventions, you need not:
Select images manually in the Xcode project settings
Edit any info-plist
The naming conventions work at least in iOS 5, 6, and 7. I believe they also work in earlier versions as well.
†Image files should not be nested in any physical folder. After adding them to Xcode, you may group them into a virtual folder within Xcode's project listing to avoid visual clutter.
Tip: To verify which image is being used, alter the image itself to display the file name as part of the image. Make a backup of your images first, of course.

Related

Black screen instead of launch image on iPad

I am developing an iPhone app for iOS 6.1 and 7 (using Xcode 5). I have a problem with iPad launch images.
On iPad 7.0 and 7.0.2, the launch image is not showing up(in 6.1 works!): I get black screen while app is loading.
I don't face this issue with iPhone 6.1 and 7.0.2, although I set all launch images required for iPad and iPad retina (landscape and portrait) and I use Asset Catalog.
What am I missing?
Recently I faced same issue with my App designed only for iPhone , I had the problem where the launch images would not appear in iPad (On iPad ios >= 7.0.x the launch image is not showing up I get black screen while app is loading (in iPad ios < 7.0.x it works fine )).
I don't face this issue of launch image with iPhone worked fine in all iOS versions.
Solution: Is to update to asset catalog to manage your app's images and target only iOS 6 and Prior.
Steps :
Step 1:
Step 2:
Step 3: on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images.
Uncheck the iOS 7 check boxes for iPhone, Now you should be able to see the launch images for iPad on iOS >= 7.0.x.
If you have the same situation like mine, that's solution:
My app is landscape only, iOs7 only, ipad\iphone (XCode 5).
Problem: black launch on iphone (and simulator), normal launch in ipad.
Solution: go to Images.xcassets - Launch Images - select it. Uncheck at right all "iOs7 and later" boxes. Check "iOs6 and prior" boxes and fill empty spaces with images.
Strange, but works.
Per Apple's documentation (link); an empty iPad specific storyboard may be the answer. I've also seen issues where the initial view controller is not set within a storyboard causes a black screen. A variant of this issue might be an incorrect setting in the app plist.
Technical Q&A QA1780
Why does my app launch to a black screen on iPad?
Q: Why does my app launch to a black screen on iPad?
A: Apps that have been designed only for iPhone may launch to a blank screen when run on an iPad. This is caused by the presence of an empty iPad specific storyboard in the app bundle as well as an iPad specific UIMainStoryboardFile key in the app's Information Property List (Info.plist) file. Both are automatically created by the various Xcode template projects if the Universal option is selected.
...
In Xcode
Look for a file named MainStoryboard_iPad.storyboard in the file navigator. If this file is present, remove it from your project.
In your app's Information Property List
Look for a key named Main storyboard file base name (iPad) or UIMainStoryboardFile~ipad. If this key is present, remove it. You should also remove any other key suffixed with (iPad) or ~ipad.
Finally, test your app on an iPad or in the iPad simulator and verify that it behaves as expected.
I requested Apple support and it turned out that it's a bug. They asked me to report it and I did. Here is the report id : 15340531.
Now it's up to them.
Using LaunchScreen.storyboard
I was having a similar problem until I found the following settings in the General Project Settings.
Set your Main Interface to your main storyboard file. Mine is called Main.storyboard.
Set your Launch Screen File to your launch screen storyboard file. Mine is called LaunchScreen.storyboard. (This is what I had originally ommited.)
After that the launch screen loaded first and then the main story board loaded shortly later.
Try set the image again make sure that resolution of the splash screen is according to the iOS 7 guidelines
I know this sounds stupid. I've had bugs like that when I saved a file in psd-format with a jpg extension. Just 1 wrong click while saving your launch image.
After having tried several solutions found here, I suspected that the iPhone was trying to launch in Landscape orientation, and thus not finding any corresponding launch image. Indeed, the simulator was starting in Landscape for a reason I was not understanding.
Finally, after reading Apple documentation, I found that it's probably the order of keys in "Supported interface orientations" of the info.plist file that was not adequate. The Portrait was the last item. When it's the first item, the app launch in Portrait mode and find the image.
Remove previously installed app from the device or simulator, Then relaunch the app after clean.
I had the problem where the launch images would no appear in iPhone (3.5 or 4 inch) in iOS 7, but the iPad had no problems with iOS 7.
Long story short is I disabled the asset catalog for the launch images only. So I'm adding the launch images the old fashioned way. That seems to have solved the problem.
I will have to do more testing tomorrow, but it seems the problem is solved (at least in my case).
in Xcode 5 , make sure thay you add all needed images mentioned in your app target.
I am assuming that when you are using Asset Catalog, you have ensured that you have the Images.xcassets target membership added correctly. I am mentioning this since if you have multiple targets, looks like you have to add them manually (and you have not provided any screenshots so one can be sure).
Now that you have not really provided a screenshot of the "LaunchImage" overview of Images.xcassets folder in your project, I can only guess the probable reason. Looking at the fact that the launch images work fine for iPhone (6.1 & 7.0.2 and iPad (6.1) and do not work only for iPad (7.0 and upwards), I think you could perhaps look at as to whether the dimension of the images for iPad Portrait and iPad Landscape are proper for iOS7. Specifically, you should see your launch images and not empty rectangles as seen in the attached pic-
This can happen due to the fact that you still have the iPad launch images for iOS7 created excluding the status bar area. Prior to iOS7, the iPad launch images were created to exclude the status bar area, but it's a must on iOS7 that all the launch images must include the status bar area. Please go through the section "Things Every App Must Do" in Apple iOS7 UI transition Guide (https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf).
The following screenshot should explain what I am talking about-
e.g. you can see that iPad Landscape Retina image dimension for iOS6.1 and previous is 2048x1496 (excluding 40 px for status bar) but the dimension for the same image for iOS7.0 and upwards is expected to be 2048x1536 (including the 40px for status bar). So, if you have not changed your images accordingly, you will see black screen for images on iPad 7.0 and upwards. On iPhones, you will not face this issue since iPhone launch images always cover the status bar, be it iOS6.0 and iOS7.0- so the new UI requirement is already met for iPhone launch images.
I found this answer which worked for our app (iPhone only, but used on iPad): https://stackoverflow.com/a/19448782/1258419
To summarize from that answer:
How to do it. Go to the asset catalog. And on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images. Uncheck the iOS 7 check boxes for iPhone. Now you should be able to see the launch images for these devices.
I encountered a similar problem in landscape, my iOS 7 launch image wasn’t displayed while the iOS 6 did. Mine was the iPhone Retina 3.5” launch image.
Since I have another app in portrait that didn’t share this issue, I did 2 things:
In info.plist, under “Supported interface orientations”, I added the
2 portrait modes as well, and put them before the landscape, like
this:
Item 0: Portrait (top home button)
Item 1: Portrait (bottom home button)
Item 2: Landscape (right home button)
Item 3: Landscape (left home button)
Implemented this method in the View Controller:
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
This works with or without the Asset Catalog.
This is an update for iOS 8.
I got the same problem when I tried to add a LaunchImage to my iOS 8 app.
Apple enables developers to use a xib, whose default name is LaunchScreen.xib, to render the launch view as of iOS 8. I believe developers can use either LaunchImage or LaunchScreen.xib. Unfortunately, I couldn't find any document describing how to deal with LaunchImage after LaunchScreen.xib was introduced. I always got a black screen when I tried to use LaunchImage as the launch view.
My solution is:
Don't think about LaunchImage. Use LaunchScreen.xib. (You have to keep an empty LaunchImage in your Asset Catalog though. I believe it's a bug.)
Drag an UIImageView to the xib and make the UIImageView full screen. Remember to take the size classes and constraints into account.
Set an image whose resolution is enough for iPhone 6 plus to the UIImageView.
Check your all images and see if it is properly placed in the Asset and properly named and sized.
Also check which orientations your are allowing and accordingly add images to the asset.
I had the same problem.
I had to make a workaround: used the Default image for all iOS versions and DELETED the UILaunchImageFile key from info.plist.
I cannot use different launch images for iOS 7 and previous versions, so, I had to use the same "artistic" image for all, instead an image that mimic the first view of the app (which Apple recommends and I prefer), but at least I do not get the black screen anymore.
It looks like the UILaunchImageFile key that allows to use differents launch images for iOS 7 and previous versions is not working properly for Retina iPad in iOS 7.
WARNING: I am still testing the app, so I don't know if could be some side effects.
I also faced the similar issue but its solution was simple (in my case).
All I did was following -
1.Add a new file (if you have not added it) Launchscreen.storyboard
2.Get a UIViewController, mark it as Is Initial View Controller then add a UIImageView in it and set a picture which you want to display during launch of your app. Make sure you give this UIImageView required constraint.
3.Go to Project->General->App Icons and Launch images and select Launchscreen.storyboard as Launch Screen File (There will be a dropdown for it).
Because of iOS 13 and later, app launch different than earlier versions.
Get the solution from below URL.
https://stackoverflow.com/a/59913274/883505
I simply forgot to call super.loadView() in my view controller...
override func loadView() {
super.loadView()
}

How do you update the app icons and launch images to support IOS 6 and 7 simultaneously?

I have been stymied figuring out how to release an application from Xcode5 that supports IOS7 AND IOS 6+ in the same build, with assets (icons and splash screens) that load correctly for both, AND still render the assets for IOS 6 correctly. The major hangup I had was trying to make IOS 6 still render the icons without shading or highlighting since the "prerendered" option is no longer even available in Xcode 5's GUI. Any ideas how to get all of the content and the icon to render correctly AND support multiple OS versions?
Andrew
Apple has clear guidelines on requirements for IOS 7 apps but even then, I ran into errors making a single app support multiple OS versions. After getting it to work, I thought I would point out a few areas that were hangups for me to aid others in the future.
I first updated the whole of my app to support IOS 7 cleanly and then went back and enabled previous versions but that process is not necessary.
Just ensure you first set the correct deploy target
Once you set the deployment target, Xcode5 nicely changes the list of default assets it requires to support the multiple OS versions. Ensure you reupload the correct versions of icons at the required resolutions and required filenames (shown below for IOS6-IOS7 support)
Do the same for the launch images, note that you will have to rename your launch images to new names, Xcode tries doing this for you if you let it. Note the new sizes below, as IOS7 expands the launch image background behind the status bar.
Finally, manually add the two .plist flags below and you should be set to have your icons render across IOS versions consistently, with no gloss (explanation follows)
IOS7 in its new flatness removes the postprocessing the previous versions did where they added a highlight and gloss effect to icons. That effect is no longer done for IOS 7 apps but if you load an app from Xcode5 on IOS 6, it will reapply the default gloss effect. This is infuriating because there no longer is a "prerendered" GUI flag in Xcode to disable that postprocessing. As mentioned above, you need to add the flag manually to your application's plist. In my case, I had to add the flag in two locations to force IOS 6 to stop applying the effect. You can access the plist by either opening the file directly or navigating to the settings in your project overview. You may need to uninstall the app from your simulator and then rebuild the app to force simulator to lose its cache of the old icon.
If you setup the asset catalogue you can open it select the image and then go to the inspector and tick this box
Just use "asset catalog" (you can select that from general on your target).
That would create an images.xcassets on your project there you can easily drag your icon designs for pre iOS 7 and for iOS 7.
UPDATE:
So after the formal release of iOS 7 I can now write this:
On the asset catalog itself select the Appicon set that you want to set as pre-rendered then go to Attribute Inspector and just mark "iOS icon is pre-rendered". you can also set there of course which OS and devices you want to support (it would create all options so you can just drag& drop to set).
Important thing to note is that for some reason if you use several targets and several sets inside this catalog you must add the Target Membership manually. To do this just mark the "asset catalog" file, go to file inspector and mark all targets where you want to use it. I think Apple should do that automatically when you select the "asset catalog" from the target settings but till then I decided to mention that here (took me an hour to figure this out).
I went through this recently. Seems by default it only shows the following.
Easy fix is add a new AppIcon
To give you all these options.
My experience with this:
When creating a new empty app, it will create a "default" app icons / launch images asset catalog that is incomplete as stated by #Smick.
The annoying part of this new "catalog" is that it doesn't show the image sizes.
To work around the issue, select the project on the project navigator, and on the "General" you will notice 2 areas - App Icons and Launch Images. Those will point to an asset catalog. You can change it to "don't use asset catalog." After that, the interface will change to a list of files / dimensions.
However there are several issues with this interface:
It should only ask for the retina versions of the images (and compute the normal, or have two links, one for normal and another for retina).
Several images (the launch ones) need to be renamed for them to work (the system does this for you).
Two images are not assignable due to errors (iPad Portrait iOS 7, and iPad Landscape iOS 7, both in normal resolution) - you can specify an image for them, but the image will not stay on and will become de-selected when you insert the next image.
The image dimensions specified are slightly different from the ones stated on the HIG manuals.
I've a strong dislike of the "new" notation of images with points (as they are device dependent and so not exact).
If you don't want to see iOS 6 reapply the "highlight / lighting" on the icons, you need to add a key on the app plist (project manager | project | info. There, you can add a key "Icon already includes gloss effects". You may need to add it also on iOS 5 icons if required.
For Xcode 6
For LaunchImage you must make sure you check iOS 6.0 and Prior
iPhone (Portrait ) or iPad // depend on your project configuration
Sizes
Default.png (320x480)
Default#2x.png (640x960)
Default-568h#2x.png (640x1136)
The same to AppIcon

Using in app purchase to unlock iPad UI? [duplicate]

I've seen tons of questions and answers regarding merging an iPhone and an iPad app into an universal app, but that isn't what I want to do. What I am going to do is use in app purchase to unlock an iPad interface and then display the correct interface using conditionals. If the interface is purchased, the app displays the iPad Nib, and if not, it just displays the same way as an iPhone application does (with the option to scale the app, etc). The conditionals are very simple and I have already implemented them, however the issue I run into is this: If the IAP is NOT purchased, the iPad displays the iPhone Nib, but not in the typical way. It is just in the corner with no option to scale it, rather than in the center with the black border that you usually see. Does anyone know how I can set it up so i fixes this issue? I'm a little stumped to be honest.
The Info.plist file in an iOS app contains a key, UIDeviceFamily, which lists the devices that the app natively supports. If the key's value is 1, or a array containing 1, the app natively supports iPhones and iPods Touch. If the value is 2, or a array containing 2, the app natively supports iPads.
If UIDeviceFamily says the app supports iPads, then it will run the app in native iPad mode, not in iPhone-wrapper mode.
The Info.plist file is part of your app bundle, and you can't modify files in the app bundle.
So there is no way to enable or disable the system's native-iPad support at runtime. You'll have to move your app's top-level view into a wrapper view that centers and scales its child, and use that wrapper view as the UIWindow's subview.
UIDeviceFamily in the Information Property List Key Reference
This isn't possible, unfortunately. The iPad will know that the app is iPad ready and will tell draw the screen at full size. Even if you showed iPhone xib file on the iPad, they would still be scaled to fit the full screen using the UIViewAutoresizingMask params you've set for them.
One thought would be to force the size of your UIWindow to be iPhone sized (remember to account for retina) and centered, but I'm not 100% sure how/if this would work. You may have to change each UIView frame. I'm not sure.

Running a universal app as a scaled iPhone app?

I've seen tons of questions and answers regarding merging an iPhone and an iPad app into an universal app, but that isn't what I want to do. What I am going to do is use in app purchase to unlock an iPad interface and then display the correct interface using conditionals. If the interface is purchased, the app displays the iPad Nib, and if not, it just displays the same way as an iPhone application does (with the option to scale the app, etc). The conditionals are very simple and I have already implemented them, however the issue I run into is this: If the IAP is NOT purchased, the iPad displays the iPhone Nib, but not in the typical way. It is just in the corner with no option to scale it, rather than in the center with the black border that you usually see. Does anyone know how I can set it up so i fixes this issue? I'm a little stumped to be honest.
The Info.plist file in an iOS app contains a key, UIDeviceFamily, which lists the devices that the app natively supports. If the key's value is 1, or a array containing 1, the app natively supports iPhones and iPods Touch. If the value is 2, or a array containing 2, the app natively supports iPads.
If UIDeviceFamily says the app supports iPads, then it will run the app in native iPad mode, not in iPhone-wrapper mode.
The Info.plist file is part of your app bundle, and you can't modify files in the app bundle.
So there is no way to enable or disable the system's native-iPad support at runtime. You'll have to move your app's top-level view into a wrapper view that centers and scales its child, and use that wrapper view as the UIWindow's subview.
UIDeviceFamily in the Information Property List Key Reference
This isn't possible, unfortunately. The iPad will know that the app is iPad ready and will tell draw the screen at full size. Even if you showed iPhone xib file on the iPad, they would still be scaled to fit the full screen using the UIViewAutoresizingMask params you've set for them.
One thought would be to force the size of your UIWindow to be iPhone sized (remember to account for retina) and centered, but I'm not 100% sure how/if this would work. You may have to change each UIView frame. I'm not sure.

iphone app only showing in little window on ipad

I have developped an iPhone app and I now need it to work on iPad. On the simulator the app only show in a little window (the x2 zoom enable the app to work in full screen) but is there a way to have the app directly showing in full screen ?
Thanks a lot,
Luc
go to project settings and set Targeted Device Family to iPhone/iPad
As Max said, go to project setting and set Target Device Family to iPhone/iPad. But this is not enough. With this change the application type will be universal application. This is good, because the app will start in full screen, but if you hard coded the dimensions of the views in the application then the look and feel on the iPad will be bad. So do the first step what Max suggested for you and then check if the app looks like you want, because it will not arrange the views automatically. You should do the changes from code or from nibs.
There is a little help if you set properly the autoresizing masks.
Edit:
Project menu -> Edit Project settings -> Targeted device family
You will need to do at least the following:
Change the Targeted Device Family to include the iPad.
Create or convert all needed .xibs for the iPad (using the Interface Builder Menu).
Reference the top level iPad .xib from your app's info.plist (using the NSMainNibFile~ipad key).
Handle the iPad paradigm wherever the controller or view source code needs to differ.