Because it comes up on StackOverflow, I dunno, maybe five times per day, I thought I'd make a quick post describing how to make your apps work well with the new iPhone 5 screen dimensions (while still remaining compatible with older iPhones).
It's really not that hard at all. TaskLog had iPhone 5 support when it launched. It took me about 5 minutes to make this work, and probably a few additional hours to make it work well.
The first step is to include an iPhone 5 specific default launch image. This is what iOS uses to determine whether or not your app is ready for the larger screen size.
It should be 640 x 1136 pixels. If you drag it into the Launch Images in Xcode, it will be automatically named for you. If you just add it to the project yourself, make sure you name it correctly: "Default-568h@2x.png".
Once you do this, your app will be sized to fit the iPhone 5 screen. From there, the amount of work you need to do depends entirely on how your application is built. If you've set up all your views with proper resizing characteristics (either via Auto Layout or the old-school autoresizing masks), you might be done. Just make sure to test it out in the Simulator (choose Device->Hardware->iPhone 5 (Retina) ) and make sure all your views look nice. I can't stress this enough: test every one of your views on both 3.5" and 4" devices (or the simulator, at the very least).
Places where you might have gotchas: if you're doing any kind of hardcoding of coordinates, there might be some tweaking you need to do. If you're going to move or size things in code, based on coordinates, at least try to do so via relative, rather than absolute, coordinates.
Related StackOverflow questions:
- How to develop or migrate apps for iPhone 5 screen resolution?
- Apps compatible with iPhone5 and reverse
- Screen height compatible in iphone5 and iphone4
- iOs 6 different storyboards for iphone5 and other iphones
- What is the best way for supporting both screen resolution of iPhone4 and iPhone5 ? - Auto layout in only iOS6
- Xcode Storyboard displaying the new iPhone 5 screen size?
- How to deal with iPhone 5 screen size?
- Obj-C, how do I get the height of a sub view to scale, across all iPhone sizes?
- iOS 6 4-inch device screen scale is 2.0 is that a bug, is it correct for height?
- Screen height for iPhone4 with 4-inch screen
No comments:
Post a Comment