4
votes

I'm a bit confused here. If, say, I want to set an image as background (full screen) for my ios app (iphone), what are the sizes for the image I have to make? I googled and found no clear answer yet.

Using image assets gives no explanation either. I tried creating new image set, it just shows 3 slots for 1x, 2x, and 3x. How the xcode differentiate between what image to use for iphone 5 and iphone 6 (different ratio)?

EDIT

I seem to be unclear about my question. If the image for iphone 5 and 6 is the same, doesn't the aspect ratio differ? It will be stretched on one device or vice versa on the other and I don't want that. Back before the iphone 6, I just create image .png, @2x.png, and [email protected] with the size 320x480, 640x960, and 640×1136. So my question is, for iphone 6 and 6+, what is the naming and size for my images?

2
As of my knowledge its not possible to add different images for iPhone 5 and 6. But you could try something with this developer.apple.com/library/mac/recipes/… - Johnykutty

2 Answers

2
votes

If, say, I want to set an image as background (full screen) for my ios app (iphone), what are the sizes for the image I have to make?

You can use [UIScreen mainScreen].bounds's width & height to setup your view frame.

it just shows 3 slots for 1x, 2x, and 3x

They're not used for handling ratio of displaying, just for display solution (retina or not). You can just use xxx.png in your code, and it'll choose to use [email protected] or [email protected] appropriately.

How the xcode differentiate between what image to use for iphone 5 and iphone 6 (different ratio)?

UIImageView has an instance method called -setContentMode:, you can use UIViewContentModeScaleAspectFill mode for displaying in different devices w/ different ratio, i.e., some parts will be cut off.

1
votes

This link should give you an overview of the differences between the 1x, 2x and the 3x image assets which we get once we create a new image asset.

http://9to5mac.com/2014/08/29/support-for-3x-image-assets-found-in-latest-ios-8-beta-ahead-of-larger-display-iphone-6/

Also when you create a new image asset, you can select image for specific devices such as (iPhone and iPad), if you are only developing for certain devices.

Select the devices as "Device Specific" from the Image Set Shown on the right side of the image.

As for you question, iPhone 5 and iPhone 6, xcode will take the same image assets i.e. 2x, for iPhone 6 Plus it takes the 3x image.

enter image description here

App Icon and Launch Image

Now for the App icon and the Launch image, this following link will guide you through.

http://www.iphonelife.com/blog/31369/unleash-your-inner-app-developer-managing-images-xcode-5-asset-catalogs

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html

for the launch image there are different options available, such as you can individually set images for the landscape and portrait images for different devices.