-2

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?

Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241
  • 4
    I voted to close as "primarily opinion-based" as you are asking for the "best" way to do something. There is no "best" way. You've also described the solution, you've demonstrated that you already know what you need to do so there is no question here. – Jasarien Dec 19 '13 at 10:22
  • @Jasarien ... this is a normal question... why you request to close it? I never used storyboard and I want to know if it is a good solution or if it can give me some problems... – cyclingIsBetter Dec 19 '13 at 10:25
  • 1
    @blackguardian there will be no one solution and even my answer is based on my own preferences. All solutions for this issue will be very based on the person experience en preferences. – rckoenes Dec 19 '13 at 10:30

2 Answers2

2

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.

rckoenes
  • 69,092
  • 8
  • 134
  • 166
  • but what the differences between "UIViewAutoresizing" and "Autolayout", I used the first to set the content in UIViews and not in other situation. – cyclingIsBetter Dec 19 '13 at 10:32
  • `AutoLayout` has constraints and can adjust more then just height, width and even take in account the size of other UI elements. Where as `UIViewAutoresizing` is simply said a hook to some part of the view. For example the navigation bar is hooked to left, top and right of the view it contain in and also grows in width. – rckoenes Dec 19 '13 at 10:35
  • ok thanks, it means that I'll begin to use autolayout in my project, thanks – cyclingIsBetter Dec 19 '13 at 10:43
0

Well , if you want to make app that run on both iOS 7 and iOS 6, than its better to use Autolayout, because it is easy to use, and also too much flexible. Because your other options are too much complex and time consuming as well.

Shabir jan
  • 2,295
  • 2
  • 23
  • 37