Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retina display and [UIImage initWithData]

I need to initialise images from raw data downloaded from a server which delivers the correct size of image based on the type of iPhone client.

I know that I should be setting the scale value to be 2.0 on the 640x960 display, however this is a readonly property and cannot be set during the init when using initWithData.

Any ideas?

like image 316
Sam Avatar asked Jul 20 '10 11:07

Sam


1 Answers

I'm not aware of anything you can embed in the image data itself to tell the phone that it's a @2x image, but something like this should work:

UIImage * img = ...; img = [UIImage imageWithCGImage:img.CGImage scale:2 orientation:img.imageOrientation]; 
like image 149
tc. Avatar answered Sep 18 '22 17:09

tc.