I want to specify different background images for iPhone each device. Like this
iPhone 6 Plus 1242x2208 pixels [email protected]
iPhone 6 750x1334 pixels [email protected]
iPhone 5 640x1136 pixels [email protected]
iPhone 4 640x960 pixels [email protected]
iPhone 3GS 320x480 pixels bg.png
In LaunchImage
there is option available to specify images for Retina HD 4.7
device. So no problem for Launch Images.
In .xcassets
file, I have option for 1x
, 2x
, Retina 4 2x
and 3x
. But there is no option for iPhone 6 (1334x750)
device.
So how to provide 1334x750 px
image for iPhone 6 device? Looking for some solution using .xcassets
file, not by programmatically loading images for each device.
I have already visited the related SO's questions, but none of them answers specifically for iPhone 6 device images.
iPhone 6 Plus resolution confusion: Xcode or Apple's website? for development
xcode 6 asset catalog iphone 6
set your image name like this;
image-320@2x//iPhone 5
image-375@2x//iPhone 6
NSNumber *screenWidth = @([UIScreen mainScreen].bounds.size.width);
NSString *imageName = [NSString stringWithFormat:@"image-%@", screenWidth];
UIImage *image = [UIImage imageNamed:imageName];
Images.xcassets has option to provide separate image for iPhone 5(Retina 4 @2x), iPhone 6(@2x) and iPhone 6 plus(3x).
There is no option for iPhone 4 asset(probably apple is stopping iPhone 4 support) rather it takes @2x images (scale mode) for iPhone 4 also but you can do something like This post for iPhone 4
Update Xcode 7
There is no option for separate image with Images.xcassets now in Xcode 7, We have to use same 2x images for all Retina devices and 3x for Retina HD device
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With