Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why have 2 storyboards when there is AutoLayout?

With iOS6 there is AutoLayout, which is a constraints based layout system. I guess it is somewhat comparable to Android's flexible XML layouts.

I am kicking off an iOS6 project and want to you AutoLayout. This app will be universal. It will have some views that are extremely similar between 2 device families. Others views on the iPad will be 2 or more controllers in the iPhone views.

From what I understand, UIViewControllers can be setup with other child UIViewControllers. This means there's 2 ingredients to building a universal view in both devices.

So my question is, why is there a need for 2 storyboards? I can see that the iPad storyboard has some additional controls etc. There's also problems of scaling font sizes and other variables between the two device types. Can anyone offer advice on how to not have duplicated views on 2 storyboards and use AutoLayout efficiently to achieve a good universal app?

Much appreciated.

like image 440
dineth Avatar asked Jan 24 '13 23:01

dineth


2 Answers

iPad UIs tend to not be simply enlarged versions of iPhone UIs. There's more screen space to use, and there are custom iPad-only interface elements (e.g. UISplitViewController).

If in your case the different devices have very similar layouts, then yes, you could just use one layout with autolayouts and it could work ok. However, I'd recommend against it in most cases. It's clearer to just have two layouts, one for each kind of device.

The final decision is up to you. Maybe you could try the single layout strategy, using autolayouts, and see if you come up against any particular problems.

like image 164
occulus Avatar answered Nov 15 '22 18:11

occulus


It is my experience that it would probably be easier for you to not use the storyboards and make everything programmatically, but that is more opinion based.

Your question is a little vague, but my opinion would be to setup views with auto-layouts as you mentioned, and then have a controller that uses those views. What will end up happening is that you will have view within views within a controller, and this will allow you to control all the layouts while being able to pick and choose what goes where, depending on the device.

It might help some if you gave a more specific example to run with. TO be honest though, this is something that interests me as well, and I look forward to seeing other ideas on this.

like image 35
Kinetic Stack Avatar answered Nov 15 '22 18:11

Kinetic Stack