Search code examples
iosstoryboardautolayoutiphone-5screen-size

iPhone 4 and iPhone 5 compatible app - Storyboards or Autolayout?


I should create an app compatible with the screen sizes of the iPhones 4 and 5. On the web I found some ways to organize my project. The best ways to do it are to:

  • create two storyboards,call one when screen size is 568 and the other when screen size is 480

  • use autolayout and have an unique storyboard

I don't know how to use autolayout and I should learn its implementation in my project. Then in this situation, I want to know by your experience what's the best approach.

I think that first approach is very intricate and slow, with two storyboards you can make mistakes and don't have the same situation in each device. In my experience I used xib files, and I used two xib file for each viewcontroller, a solution which is very very noisy. Then, what can you tell me about these approaches?


Solution

  • AutoLayout will make it easier to adjust your UI for both screen size, but even with the old UIViewAutoresizing you will be able to get everything working.

    I would suggest that you do not use 2 storyboards or NIB for that mater, because if a some point an other screen size is introduced you need to create a third storyboard/NIBs.

    You can even use the UIViewAutoresizing in NIB and in code.

    Just set the autoresizing mask correct to grow/shrink with the screen size and you will be good to go.