How to develop or migrate apps for iPhone 5 screen resolution?
All apps will continue to work in the vertically stretched screen from what I could tell in today’s presentation. They will be letterboxed or basically the extra 88 points in height would simply be black.
If you only plan to support iOS 6+, then definitely consider using Auto Layout. It removes all fixed layout handling and instead uses constraints to lay things out. Nothing will be hard-coded, and your life will become a lot simpler.
However, if you have to support older iOS’s, then it really depends on your application. A majority of applications that use a standard navigation bar, and/or tab bar, could simply expand the content in the middle to use up that extra points. Set the autoresizing mask of the center content to expand in both directions.
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
It works great out of the box for table views, however, if your app used pixel-perfect layout for displaying content, then your best bet would be to re-imagine the content so that it can accommodate varying heights.
If that’s not a possibility, then the only remaining option is to have two UIs (pre iPhone 5, and iPhone 5).
If that sounds ugly, then you could go with the default letterboxed model where the extra points/pixels just show up black.
To enable your apps to work with iPhone 5, you need to add a retina version of the launcher image. It should be named Default-568h@2x.png. And it has to be retina quality – there’s no backward compatibility here
You could also select this image from within Xcode. Go to the target, and under the Summary section, look for Launch Images. The image has to be 640×1136 pixels in size. Here’s a screenshot of where to find it, if that helps.
Autorotation is changing in iOS 6. In iOS 6, the
shouldAutorotateToInterfaceOrientation:
method of UIViewController is deprecated. In its place, you should use thesupportedInterfaceOrientationsForWindow:
and shouldAutorotate
methods. Thus, I added these new methods (and kept the old for iOS 5 compatibility):- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- Used the view controller’s
viewWillLayoutSubviews
method and adjust the layout using the view’s bounds rectangle. - Modal view controllers: The
willRotateToInterfaceOrientation:duration:
,willAnimateRotationToInterfaceOrientation:duration:
, anddidRotateFromInterfaceOrientation:
methods are no longer called on any view controllerthat makes a full-screen presentation over
itself—for example,presentViewController:animated:completion:
. - Then I fixed the autolayout for views that needed it.
- Copied images from the simulator for startup view and views for the iTunes store into PhotoShop and exported them as png files.
- The name of the default image is:
Default-568h@2x.png
and the size is 640×1136. It´s also allowed to supply 640×1096 for the same portrait mode (Statusbar removed). Similar sizes may also be supplied in landscape mode if your app only allows landscape orientation on the iPhone. - I have dropped backward compatibility for iOS 4. The main reason for that is because support for
armv6
code has been dropped. Thus, all devices that I am able to support now (runningarmv7
) can be upgraded to iOS 5. - I am also generation armv7s code to support the iPhone 5 and thus can not use any third party frameworks (as Admob etc.) until they are updated.
That was all but just remember to test the autorotation in iOS 5 and iOS 6 because of the changes in rotation.
How to develop or migrate apps for iPhone 5 screen resolution?
Reviewed by Unknown
on
12:25
Rating:
No hay comentarios: