Recent Posts

Showing posts with label iphone 5. Show all posts
Showing posts with label iphone 5. Show all posts

How to migrate applications for iphone 5 resolution

The new iPhone 5 display has a new aspect ratio and a new resolution (640 x 1136 pixels).

To make applications "universal" for both the older displays and the new widescreen aspect ratio follow the following steps:

  1. Download and install latest version of Xcode.
  2. Set a 4-inch launch image for your app. This is how you get 1136 px screen height (without it, you will get 960 px with black margins on top and bottom).
  3. Test your app, and hopefully do nothing else, since everything should work magically if you had set auto resizing masks properly.
  4. If you didn't, adjust your view layouts with proper auto resizing masks or look into Auto Layout if you only want to support iOS 6 going forward.
  5. If there is something you have to do for the larger screen specifically, then it looks like you have to check height of [[UIScreen mainScreen] bounds] (or applicationFrame, but then you need to consider status bar height if it's present) as there seems to be no specific API for that.


Example:

CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
    // code for 4-inch screen
} else {
    // code for 3.5-inch screen
}

Also note: The auto-rotation API has changed completely, take a look at that as well if your application supports any rotation other than default.