Search code examples
iphoneobjective-cioscocoa-touchretina-display

How I add retina images to my app? Do I just add like "@2x"?


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...


Solution

  • 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 "[email protected]".

    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 "[email protected]" 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.