I am working on a universal application with hundreds of background images. To save disk space and prevent further duplication and spam, I want to reuse non-retina @ 1x iPad images as retina @ 2x iPhone images.
Example:
background125_iPad@2x.png
background125_iPad.png
iPhone 4 and 5 have different aspect ratios, so I scale the 1024x768 images to fit.
But the problem is that if I use this on iPhone 5:
UIImage *img = [UIImage imageNamed:@"background125_iPad.png"];
then iOS will try to become smarter than me and choose a huge memory monster @ " background125_iPad@2x.png ".
Is there a way to say: βiOS, look. I'm smarter than you. I want you to download this file. And I really mean this file. THIS AND AND treat it as if it were a @ 2x version with a large by a factor of 2. " so that it really loads the requested file "background125_iPad.png", but then the UIImageView acts as if it had 512 x 384 pixels (= 1024x768 px)?
I guess there is UIImage imageNamed
no way to go then?
source
share