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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With