It is remarkably easy to do so and I implore all all iPhone developers to please upgrade all their apps to support the Retina Display on the iPhone 4, otherwise your app just looks blurry.
What Apple achieved with the Retina Display is a remarkable feat. The screen is still exactly the same size of 3.5 inches but where you used to have 1 pixel you now have 4. This means UI elements are scaled exactly by 2.
Developers were always told to design for a screen resolution of 320×480 pixels, so don’t I need to change my UIViewControllers to have a different size?
Well no, and this is how Apple have been incredibly clever. The screen dimensions are now 320×480 points, and not pixels so in your UIViewController you still have the size 320×480. With me so far?
Ok so lets say I have an image that needs to span the width of the screen and is only 100 pixels high on an iPhone 3G or 3Gs we simply embed an image of 320pixels by 100pixels. So that image that we’ve called banner.png, for example, looks perfect on those old devices but they look blurry on the iPhone 4.
I can hear you asking, if the screen is 320points wide but is actually 640pixels wide, how do I provide both an iPhone 4 and iPhone 3G(s) version of this and how much code does it take.
Well my answer is, very easy and zero, that’s right, zero code modifications.
Now you did have a high resolution, or vector version of your artwork right? Ok well open it up and scale it to exactly double the size of the original file. So you’ll now have an image that is 640×200 pixels and save it as email@example.com (as the original was called banner.png). Add the new image to your resources in your XCode project.
You can call your image in exactly the same way as before
UIImageView *myImage = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,100)]; [myImage setImage:[UIImage imageNamed:@"banner.png"]]; [self.view addSubview:myImage]; [myImage release];
When you run your app on your iPhone 4 (or the iPhone 4) simulator the image will magically use the firstname.lastname@example.org version instead. Clever isn’t it!
Default splash images
This is exactly the same as for images, just include a Default@2x.png image in your bundle and the iPhone 4 will use it instead.
Springboard App Icon
Ok now this one is a little more complicated, but not by much. If you’ve already designed a Universal (iPhone and iPad) app then you’ll be familiar with this technique, and actually there are a couple of ways to do it but I’ll explain the one from the Apple Docs.
If you want to still provide support to iOS 3.1.x and below you’ll still need a
with Icon.png in it for your Info.plist but you should now also include an array entry of
Include an Icon.png file, this is your non-iPhone 4 57×57 file
Include an Icon@2x.png file, this is your iPhone 4 114×114 file.
Yep once again it really is that simple.
If you have an app that simply uses SDK UI Elements and/or images, which the majority of iPhone app do, then you simply have no excuse not to support the Retina Display… so what are you waiting for, go cut graphics and submit!