Supporting iPhone 5

By Alex

Back in 2008 when the iPhone 3G came along with the first iOS SDK (former known as iPhone SDK) iOS layout development was a straight-forward process. In comparison to Android iOS only supported one screen resolution (320×480) so you did not need to handle dynamic layout adaptions for different screens and layouts in code were therefore often made in absolute pixels. Subsequently the launch of the iPad did not change this situation, as the code for iPad-support is mostly separated from iPhone code.

In 2010 Apple launched the iPhone 4 which changed the physical screen resolution of the iPhone family the first time in its history. Things however didn’t get more complicated for developers because Apple decided to exactly double the screen resolution from 320×480 to 640×960, the “Retina”-screen was born. This doubling allowed an approach V-Play is using too: The use of a logical screen size in combination with an internal scale-factor (obviously 2 on iPhone 4). High resolution images are automatically applied depending on their file name (using the suffix “@2x” in case of iOS SDK, or “-sd”/”-hd”/”-hd2″ in case of V-Play with default settings).
This approach also keeps backward-compatibility as missing high-resolution images simply get scaled to their counterparts.

This summer the launch of the iPhone 5 changed things a little bit. The iPhone got a bunch taller and therefore comes with a different resolution of 640×1136 (a logical resolution of 320×568 in iOS SDK). The initial support of the new resolution is easy to achieve, you just have to add a new launch image named “Default-568h@2x.png” (568 is the logical height, @2x the suffix for high-res screens) to your iOS project.
In theory you’re good to go and can upload your “iPhone 5 compatibility” update to the App Store, in reality however there are a lot more problems. If you’re one of the developers that used absolute positioning (which was absolutely reasonably back in time) a lot of view code might be broken, especially animation code is a source of failure as we’ve discovered in our own projects. So how to fix this? I already saw a lot of approaches that query the main UIScreen’s height and apply different code for different devices but the better solution is definitely to use dynamic layout with view auto-resizing (UIView includes an “autoresizingMask” property) and relative positioning (“auto-layout”).

What does this mean for V-Play games? The great answer is: nothing. Because of the use of a logical screen size in V-Play your game is automatically displayed on the iPhone 5 the right way without any further adaptions from your side! We’ll roll out iPhone 5 support with one of the following SDK updates, so make sure to follow our updates on our blog and on Twitter.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support