0
votes

I understand there is a file naming convention for standard images and retina (higher resolution) images. This is achieved by naming the file as <filename>@2.jpg, as an example.

Now I just ran a test on the iPad simulator that seems to suggest that it would be better to just use the higher resolution, period. The test was this: I had one full-screen image and one retina full-screen image. The low-res image simply has a "1" on it. The hi-res image shows "2" on it. Then I had the hi-res image load to fill the entire screen of the iPad simulator.

  • Result: It seems like the entire retina image was displayed in the screen.
  • Expected result: I expected the hi-res image to be partly cropped - I assumed the screen was too small to display the entire retina image.

Obvious questions:

  1. Is my test flawed (am I missing something)?
  2. And if this test can be verified, then why should we include 2 sets of images (standard and retina) if we can simply use retina? The only thing I see is that the retina images consume more memory, so it might be too much for devices that don't have retina displays.
1

1 Answers

3
votes

Whether or not the retina (@2x) image is used depends ONLY on the scale factor (the amount of pixels per point) of the screen. Both iPad and iPhone have the same behavior.

You never reference the retina images directly. Instead you load them by saying

[UIImage imageNamed:@"myImage"];

If you are on a retina display the retina version of the image ([email protected]) will be chosen for you. In either case the image takes up the same number of points on the screen. Both the retina and non-retina displays have the same number of points.