-2

I Have an app full of images, but when you run it on retina displays it gets pixelized, I have the same images with double resolution, but I don't know ho to add them to my project...

pasawaya
  • 11,515
  • 7
  • 53
  • 92

2 Answers2

4

Yes just add "@2x" to the name of your image files.

So if you have an image "someimage.png" in low resolution, name the high resolution version of this image "someimage@2x.png".

Then you have nothing to do in your code, as when you write [UIImage imageNamed:@"someimage"] or [UIImage imageNamed:@"someimage.png"] the runtime will load the right image "someimage.png" or "someimage@2x.png" depending on the resolution of the iPhone the user is running your app on.


For more information, read the Resource Programming Guide in Apple Documentation, especially the paragraph "Updating Your Image Resource Files" where everything is explained in details.

AliSoftware
  • 32,623
  • 6
  • 82
  • 77
0

Exactly as in your title. Add the image to your project with the same name as your original image but with "@2x". For example if you have "example.png" you add the retina image into your project with the name "example@2x.png" and Xcode will automatically use that image if it detects a retina display. No coding is needed.

deleteme
  • 61
  • 1
  • 6