Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone - adapt images to retina display

I have a question about updating my app's graphics for the retina display of the iPhone 4.

I am keeping each view's resolution to 480 x 320 Points.

So I was wondering: suppose I have a 100 x 50 UIImageView. It's better for my actual image I am going to load to be 200 x 100 pixels @ 163 ppi or 100 x 50 pixels @ 326 ppi? Is it the same thing in terms of 'lightness'? which is the preferred way?

Thanks, you're awesome

Lorenzo

like image 986
Lorenzo Avatar asked Mar 16 '11 21:03

Lorenzo


1 Answers

1) Define your UIImageView to be 100 x 50 pixels as you describe it above.

2) Have one image file that is 100x50 pixels "MyImage", and a second image file that is 200x100 pixels, and name it "MyImage@2x".

3) In your code, refer to the image file "MyImage".

iOS will automatically select the correct image. On older devices without the retina display (i.e., iPhone 3GS), the "MyImage" file will be used. On newer devices that have the retina display, the "@2x" version will be used.

like image 96
mbmcavoy Avatar answered Oct 01 '22 18:10

mbmcavoy