0

I would like to know how could I make my application enable for iphone 5 standards (especially screen-size).

I currently have an application designed for iPhone 4 so all the views are 460 px height.

Can I do some simple and automamic update to make it for iPhone 5? Without ruining the iPhone 4 style, I would like this app to be avaible on both.

Mayur Birari
  • 5,837
  • 8
  • 34
  • 61
frénésie
  • 1,716
  • 3
  • 16
  • 14
  • Similar question is already posted. See this link... http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution – User-1070892 Nov 29 '12 at 13:28

3 Answers3

2

There is not magic code that will make app adjust it self, just the Default-568h@2x.png top tell iOS that you app support the new 4" height.

The most important part is how you have set the Autoresize mask of you views. If then are set to grow (UIViewAutoresizingFlexibleHeight) then they will grow to fill the screen.

Check every view that the alginment of button have the correct Autoresize mask, for example if a button is ment to be at the button of the screen make sure that the Autoresize mask is set to the fix it self to the bottom and nog the default top.

rckoenes
  • 69,092
  • 8
  • 134
  • 166
  • I did nothing of this. Like Autoresize masks for example. I just clicked on my view controller in the IB, and set the form to 'freeform' and put 460 px height. What is the Default-568h@2x.png ? – frénésie Nov 28 '12 at 15:17
  • Then you will need to lern about autoresizing mask, because this tells you view how to change to the new height. The `Default-568h@2x.png` is the apps loading screen for 4" devices, this image must be 640 × 1136 pixels – rckoenes Nov 28 '12 at 15:21
  • Default-568h@2x.png it is splash image for iPhone 5 – amar Nov 28 '12 at 15:21
  • I finally got it, so everything is working as it should. But I still have one problem, I have a UIDatePicker and I would like it to be at the bottom of the screen. Actually I setted the y origin to 244 but when I load the app on a iPhone 5 the Picker is at the origin 244 and so there is some white space underneath. Is there a way to tell the Picker to be attach to the bottom ? – frénésie Nov 29 '12 at 11:31
  • You could set the autoresize mask correctly if you use interface builder. But if you create if from code you fill have to calculate the correct frame fro the date picker. – rckoenes Nov 29 '12 at 11:32
  • I use the IB to set the origin at 244. Is there any way in the IB to 'attach' the picker to the bottom ? I aslo tried the set the autoresize of the picker like all the other items, but it doesn't work for the picker whereas it works for all the other items – frénésie Nov 29 '12 at 11:39
  • Weird it should work for the date picker, just make sure that set the correct anker point (bottom and left) in interface builder on te fourth tab of the properties sheet. – rckoenes Nov 29 '12 at 12:02
1

First, see what your app looks like on iPhone 5. This can be done by including a Default-568h@2x.png within your project. This is the launch image for iPhone 5, and indicates to the OS that you support the taller screen size.

If you've programmmed your application well (for example, with decent Autoresize masks), the OS should take care of most of it for you, and it'll look decent already. If you want to use AutoLayout in iOS 6, this will also help for the iPhone 5.

If it does not look that great, then you can do some conditional modifications for iPhone 5 using the macro:

#define IsTallPhone() ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568)

So for example:

if (IsTallPhone()) {
    frame = CGRectMake(0,0,200,500); // Use Tall Frame
}
else {
    frame = CGRectMake(0,0,200,300); // Use Normal Frame
}

The conditional can be done for anything, for example to load a different .xib file. It entirely up to you.

WDUK
  • 18,870
  • 3
  • 64
  • 72
  • I did nothing of this. Like Autoresize masks for example. I just clicked on my view controller in the IB, and set the form to 'freeform' and put 460 px height. What is the Default-568h@2x.png ? – frénésie Nov 28 '12 at 15:10
  • `Default-568h@2x.png` is the launch image for iPhone 5, similar to how `Default.png` is the launch image for iPhone 4S and below. See http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/App-RelatedResources/App-RelatedResources.html on launch image resources. For autoresizing, refer to http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/CreatingViews/CreatingViews.html#//apple_ref/doc/uid/TP40009503-CH5-SW5 – WDUK Nov 28 '12 at 15:24
0

Open your project in xcode 4.5 and just add a default image of iPhone5 resolution in launch images. all other screens will be stretched to fill the iPhone 5 screen. go to target summary and add retina 4 inch launch image.

But it really depends on the graphics they may appear stretched go for separate xib if required

amar
  • 4,285
  • 8
  • 40
  • 52