This post was originally published at Tutorial: Building Multi-Screen Launch Images Using Xcode 6

In the working with the new iPhones tutorial, we showed you how to use static launch images and a large array of definitions in your build.settings file. This will, of course, get your launch images showing correctly on various iOS devices. Since the launch of these new phones, however, some apps show up as Optimized for the iPhone 6 and 6 Plus in the iTunes App Store. Unfortunately, simply including and declaring the new launch images is not sufficient to trigger this label in the App Store, but Corona developer Ingemar discovered a solution which involves your app using an Xcode-created Launch Image Storyboard.

This tutorial will direct you through the steps to download a small Xcode project, add an image to the project, change a text label, produce a small file which must be included in your Corona project, and update your build.settings to allow this App Store branding to take effect. For context, you may want to read the original forum thread as well.

Download and Modify the “LaunchImage” Xcode Project

Go to the Corona Labs GitHub repository and download the LaunchImage project. Make a note of where you keep this project, as you’ll need to use the Terminal command line to navigate to its folder later. Now, browse to the project folder in the Finder and proceed with these steps:

  1. Double-click on the LaunchImage.xcodeproj file to launch Xcode. You’ll need Xcode 6.x to thoroughly complete this tutorial.
  2. Expand the LaunchImage folder tree in the left-side Navigator column.
  3. Select the Images.xcassets entry.

  1. Create three images which will be centered on the screen of various devices. You’ll need a 1×, 2×, and 3× version — these images don’t need to match specific sizes, but they will be shrunk or stretched to fit the UIImageView while maintaining the original aspect ratio.  Make a note of the name you called these.  Suggestions include “Launch”, “Splash” and “Image”.
  2. In the central pane, look for the AppIcon entry, right-click it, and choose New Image Set.
  3. Right click on “Image” and rename it to the name you used for the Launch images in step #4.  If your images are Launch.png, Launch@2x.png and Launch@3x.png, then your image set must be named “Launch”.
  4. From the Finder, drag the file for your 1× splash image to the slot, your 2× splash image file to the slot and your 3× splash image file to the slot.

  1. Now, in the left-side Navigator column, select the LaunchScreen.xib file.
  2. In the center panel, change the text of the label as desired, or delete the label if you don’t want one.
  3. Next, click on the UIImageView, then reveal the Attributes Inspector in the right column.

  1. Click on the Image pull-down and choose Image.

  1. Make any other design changes that you want. This tutorial exhibits just a simple image and label.
  2. Save the project.
  3. Open the Terminal application and change directory to where your LaunchScreen.xib file exists. This is located inside the LaunchImage/Base.lproj folder.
  4. Type in this command: ibtool --compile LaunchScreen.nib LaunchScreen.xib
  5. Finally, copy the LaunchScreen.nib file to your Corona project folder alongside main.lua.

Changes to “build.settings”

Next, you must add a key UILaunchStoryboardName with a value of "LaunchScreen" to the plist table within build.settings:

In addition, the images that you added to the Storyboard in Xcode must reside in the same folder alongside main.lua.

IMPORTANT: If you have the UILaunchImages key and associated sub-tables in your plist table as shown in the previous tutorial, you should remove it, since this new key supersedes it.

Additional Resources

These two videos are very helpful in learning how to build Storyboard-based Launch Screens:

Supporting iOS 6 and 7

Because this technique is for iOS 8, if you plan to have launch images for people who have not upgraded yet, you will continue to need to include the Default.png images that you have in the past. These include the normal Default.png and Default-568h@2x.png files. See the Corona SDK Build settings guide for a list of all the files needed and their sizes.

If you use this technique for iOS 8 devices, the presence of the above launch images is sufficient for iOS 6 and 7; therefore, you do not need to include the UILaunchImage code in your build.settings.

Conclusion

Feel free to experiment with this process. Remember that Apple prefers your launch screen mimics the first screen that users will see in the app, versus a “branded” splash screen. This tutorial merely serves as a starting point for building launch screens via Xcode.

View article:

This post was originally published at Tutorial: Building Multi-Screen Launch Images Using Xcode 6