4
votes

We want to support iOS 6 through iOS 8. By my count, that means we need to create ten launch images.

  • portrait 2x3: 320x480 640x480
  • portrait 9x16: 640x1136 750x1334 1242x2208
  • portrait 3x4: 768x1024 1536x2048
  • landscape 16x9: 2208x1242
  • landscape 4x3: 1024x768 2048x1536

What I wish is that I could just generate the largest sized image at each ratio, and that iOS would just downsample the image for the other sizes. That would save me from adding five more launch images to my app, a nice savings in download size.

Is it possible to use the new feature of Xcode 6 to replace my launch images with storyboards (aka UILaunchStoryboardName) to do what I want?

It seems pretty close, but I can't figure out how to say, "At 2x3, use image X; at 9x16, use image Y; at 3x4, use image Z" and so on. Size classes don't seem to let me express that concept cleanly. (Or do they?)

1
I could do it in code, obviously, but the UILaunchStoryboardName xib isn't allowed to use actual code, just a xib.Dan Fabulich
The new Launch Screen File is only used under iOS 8. You still need the old launch images for iOS 6 and 7.rmaddy
Ah, too bad. Well, it'd still be useful to know the answer, even if it's just for iOS 8 and higher, because iOS 8 still supports multiple "phone" screen sizes.Dan Fabulich

1 Answers

1
votes

Here is one way to do this... Create a new image set in your existing or some new assets catalog. By default, the Devices field of the new image set, in the right pane, will be set to Universal, and so you should see three image wells in the main view: 1x, 2x, and 3x. What you want is to set the Devices field to Device Specific, then check iPhone, Retina 4-inch, and iPad underneath that field. Then, you will now see six images wells. There are four for iPhone: 1x, 2x, Retina 4 2x, and 3x. There are two for iPad: 1x, and 2x. Now, all you have to do is to drag your versions of the same splash image in various device-specific sizes, into the appropriate image wells. Once you are done, go to your launch screen XIB, which by default is set to Any width and Any height, and add a UIImageView, setting the image to have the same name as the image set you just created. Adjust the image to have the same size as the enclosing view, adding top, leading, bottom, and trailing constraints with a constant value of 0, so that the image size adjusts with the view size, regardless of the device. Run the app on your device and you should see the correct splash upon launch. You can set a breakpoint at the top of your AppDelegate code, e.g. right underneath the var window: UIWindow? declaration (or equivalent if using Objective C), so you can verify the splash on different kinds of device. Note that the image may not work in the Simulator, so try on a device. I guess that it is a bug in the Simulator, or unimplemented feature.

One thing I am not sure about is where to specify the image for iPhone 6. It seems that there are device specific image wells only for iPhone pre-4s, iPhone 4s, iPhone 5, iPhone 6 Plus, iPad, and iPad Retina sizes.