iOS: What is the @2x image?

I recently came across an interesting article talking about the @2x image in iOS. So to summarize that, if your app supports both retina and non-retina displays then you should include on image with a regular size for the non-retina display (ex. backImage.png) and another one with higher resolution for the retina display (ex. backImage@2x.png). 

XCode is smart enough to figure out which image to display based on the screen resolution! So you don’t have to do any work on your end other than referencing the regular image in your UIImageView and XCode will take care of everything for you!

Example:
UIImage* backImg = [UIImage imageNamed:@"backImage.png"];

Don’t Do:
UIImage* backImg = [UIImage imageNamed:@"backImage@2x.png"];

Thanks!
KK

Leave a Comment

Your email address will not be published. Required fields are marked *