0

As i am working on an application which i need to develop in iPhone4/iPhone5/iPad. Can somebody tell me complete flow or Tutorial link to make the application compatible with all above platforms. There is a way of auto resizing and auto layout and i don't know how to use this?

According to me, I have two ways to implement this concept, Either by taking three different xib files for iPhone4/iPhone4s/iPhone5 or by setting the frame of the layouts pro grammatically after detecting the device.

Can you please tell me any other easy way for implementing this concept?

Lalit
  • 264
  • 3
  • 10
  • If app's UI design is same on all devices, you should learn auto resizing or auto layout. By auto resizing, you can avoid using three xib's. Set auto resizing masks to views in xib from Interface builder. – Rahul Wakade Feb 01 '13 at 05:43
  • Is there any good tutorial you can suggest me for Auto resizing – Lalit Feb 01 '13 at 05:48

3 Answers3

1

If you don't want to use three different xib files for each, then you have to try this method

 CGRect screenBounds = [[UIScreen mainScreen] bounds];

after this set your code according to device

 if (screenBounds.size.height == 568)
{
    // code for 4-inch screen

}
else if (screenBounds.size.height == 1024)
{
    //code for ipad
}
else
{
    // code for 3.5-inch screen
}
Rox
  • 909
  • 11
  • 31
  • I have already implemented this code. Is there any way to implement this using single xib ? – Lalit Feb 01 '13 at 05:39
  • Here you can also use only single xib files. Just set whole code programmatically like UIView, UIButton's coordinates. – Rox Feb 01 '13 at 05:43
1

If you want to make your design compatible/migrated to iPhone5, please read these documents and questions:-

  1. Lower Version apps compatible to iPhone 5

  2. Guide Lines

  3. Helping Question

It'll help you to achieve the goal.

Thanks.

Community
  • 1
  • 1
Harpreet
  • 2,990
  • 3
  • 38
  • 52
0

Is there any shortcut way?

That depends a bit on how you want your app to look and work. If you want the UI to be about the same regardless of screen size, then you might be able to get away with merely adjusting the sizes and positions of the different elements. Far more often, though, you'll want to use the available screen space to best advantage, so you'll have more and different content on a larger screen than you do on a smaller screen. In these cases, there really isn't any shortcut: you need to think carefully about how the app will work on each device.

Even if you do want essentially the same UI on all devices, there's still a lot to be said for using separate .xib files for each. Once you know which UI elements you want on the screen, putting together a .xib is pretty quick and easy. Having separate .xibs lets you fine tune the UI for each size. In reality, you'll often need only two .xibs for each screen -- an iPad-sized .xib and an iPhone-sized one. The autolayout system is more than powerful enough to let you adjust between iPhone 4 and iPhone 5 sized screens.

Caleb
  • 124,013
  • 19
  • 183
  • 272