Possible Duplicate:
How to develop or migrate apps for iPhone 5 screen resolution?
I was just wondering with how should we deal with the iPhone 5 bigger screen size.
As it has more pixels in height, things like GCRectMake that use coordinates (and just doubled the pixels with the retina/non retina problem) won't work seamlessly between versions, as it happened when we got the Retina.
And will we have to design two storyboards, just like for the iPad?
I personally don't think Apple will require you to check the screen size every time you have to draw something, like many answers say. Does that happen with the iPad?
Well, they do work the same with Retina displays - it's just that 1 unit in the CoreGraphics coordinate system will correspond to 2 physical pixels, but you don't/didn't have to do anything, the logic stayed the same. (Have you actually tried to run one of your non-retina apps on a retina iPhone, ever?)
For the actual question: that's why you shouldn't use explicit CGRectMakes and co... That's why you have stuff like
[[UIScreen mainScreen] applicationFrame]
.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.
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.
Edit
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 640x1136 pixels in size. Here's a screenshot of where to find it, if that helps.
@Pascal's comment on the OP's question is right. By simply adding the image, it removes the black borders and the app will use the full height.
You will need to make adjustments to any CGRects by determining that the device is using the bigger display. I.e. If you need something aligned to the bottom of the screen.
I am sure there is a built in method, but I haven't seen anything and a lot is still under NDA so the method we use in our apps is quite simply a global function. Add the following to your .pch file and then its a simple
if( is4InchRetina() ) { ... }
call to make adjustments to your CGRects etc..m
This way, if you want to detect whether it is just an iPhone or iPad (regardless of screen-size), you just use:
or
If you want to detect just the iPhone 5, you can use
As opposed to Malcoms answer where you would need to check just to figure out if it's an iPhone,
Neither way has a major advantage over one another, it is just a personal preference.
I have just finished updating and sending an iOS 6.0 version of one of my Apps to the store. This version is backwards compatible with iOS 5.0, thus I kept the
shouldAutorotateToInterfaceOrientation:
method and added the new ones as listed below.I had to do the following:
Autorotation is changing in iOS 6. In iOS 6, the
shouldAutorotateToInterfaceOrientation:
method of UIViewController is deprecated. In its place, you should use thesupportedInterfaceOrientationsForWindow:
andshouldAutorotate
methods. Thus, I added these new methods (and kept the old for iOS 5 compatibility):viewWillLayoutSubviews
method and adjust the layout using the view’s bounds rectangle.willRotateToInterfaceOrientation:duration:
,willAnimateRotationToInterfaceOrientation:duration:
, anddidRotateFromInterfaceOrientation:
methods are no longer called on any view controller that makes a full-screen presentation overitself—for example,
presentViewController:animated:completion:
.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.armv6
code has been dropped. Thus, all devices that I am able to support now (runningarmv7
) can be upgraded to iOS 5.That was all but just remember to test the autorotation in iOS 5 and iOS 6 because of the changes in rotation.
I think you can use
[UIScreen mainScreen].bounds.size.height
and calculate step for your objects. when you calculate step you can set coordinates for two resolutions.Or you can get height like above and
if(iphone5) then... else if(iphone4) then... else if(ipad)
. Something like this.If you use storyboards then you have to create new for new iPhone i think.