I have an app that does a screen capture on a retina-iPad (iPad3.) Or maybe I just do the screen capture with HOME+POWER and get the image that way, it doesn’t matter. In the end, I have a captured image that is 2048×1536 — that’s 1024×768 @2x.
Now I want to display this image — this 2048×1536 image — back on the screen and I want to preserve the lovely retina-ness of it.
When I do something like this (code typed in web browser):
UIImage *myImage = [UIImage imageWithContentsOfFile: pathToMyHiresImage];
UIImageView *myImageView = [[UIImageView alloc] initWithImage: myImage];
myImageView.frame = screenBounds; // make it fit
// etc...
I end up with a low-rez (jaggy diagonal lines & text) version of the image.
So my question is: what do I have to do in order to display that image back on the screen and get it to display @2x-DPI, so it has that pretty retina-look?
Thanks!
This should do the trick:
Good luck!
EDIT (Olie)
Here is the final code, taking DavidH’s suggestion into account: