I am trying to create an application compatible with both retina and non-retina displays. I am using high resolution images and letting the OS scale them down for the non-retina displays.
The images are named xxx@2x.png and I load with the same name. This works, and the images are displayed at the same relative size on both device types. Unfortunately, the quality of the resized image on the non-retina display is far from ideal.
self.navigationItem.rightBarButtonItem.image = [localAssets imageAtPath:@"content/home/settings@2x.png"];
+ (UIImage*)imageAtPath:(NSString*)path;
{
NSString* extension = [path pathExtension];
path = [path stringByDeletingPathExtension];
NSString* filePath = [[NSBundle mainBundle] pathForResource:[path lastPathComponent]
ofType:extension
inDirectory:[path stringByDeletingLastPathComponent]];
UIImage* theImage = [UIImage imageWithContentsOfFile:filePath];
if(!theImage)
{
NSLog(@"Error no file found at %@", [path stringByAppendingPathExtension:extension]);
}
return theImage;
}
Retina:

Legacy:

If your resize your images yourself, and save them as xxx.png and xxx@2x.png, then you can use them as “xxx” and iOS will automatically use the @2x versions when using a Retina display.