0
votes

In a universal app should I have a image.png, image@2x.png, image~ipad.png and image@2x~ipad.png for every image in my project?

Or should I just use my wider iPad images and have iOS scale them down to iPhone for me?

There's a lot of images so I'm a bit concerned about the file size...

Thanks!

1
Check out this article about images for retina. One image for everybody.DOK
Are these full screen images or just icons? If they are full screen then you need a 5th for 4" iPhone/iPod touch devices. For icons you only need 2 of each.rmaddy
Not full screen no... but full width images.sayguh

1 Answers

0
votes

Not necessarily but you can see code below. If you are targeting low res iPads and Low res iPhones you would have one set of icons for each. So if you are targeting iPad retina and iPhone retina that is on set of icons too so if you have an image called car.png and car@2x.png you would have 2 icons that cover all 4 models mentioned.

You can of course have images specific for iPad as the screen is larger then in your logic you would show either or depending on the device idiom..like below

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {

//Device is iPhone
//This would give you low res icon for iPhone and if device is retina system will show it
UIImage *car = [UIImage imageNamed: @"Car.png"];
UIImageView *carImage = [[UIImageView alloc]initWithImage:car];

}

else {
//Device is iPad
//This would give you low res icon for iPad and if device is retina system will show it
UIImage *carLarge = [UIImage imageNamed: @"CarLarge.png"];
UIImageView *carImage = [[UIImageView alloc]initWithImage:carLarge];

}