Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Nicholas Fox
Nicholas Fox
5,520 Points

Auto Layout vs. 2 Storyboards for Different Sized Screens

Which is considered the "right" way to handle different sized screens?

2 storyboards seems like it could become a logistical nightmare to maintain, but Auto Layout gets pretty intense as your UI grows in complexity...

Any advice?

2 Answers

Hi, @Nicholas Fox:

Given the relative sizing Autolayout encourages, and the likelihood that they'll be larger screens to take into account soon when it comes to Apple Devices, a strategy involving AutoLayout is more efficient and future proof.

At the same time, your question is somewhat confusing as you can activate AutoLayout on multiple storyboards.

If you were to do multiple storyboards, without taking account programmatically handling things to minimize your need for them, you'll end up in a situation where you find out that what you want accomplished just simply isn't well realized through Storyboards and you'll have to refactor significantly towards less use of them.

If you must or want to use Storyboards, you'd want to have merely one for each general class of Apple devices you're targeting.

For example, don't make an iPad2 & iPad3 storyboard--make a general 'iPad' storyboard and leverage auto layout to provide a solid base experience for users of older iPad devices.

Things can get complicated when you have to provide distinct or enhanced experiences for users of your app depending on the orientation of their device. You'll have to do things like the following code snippet:

if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) {
        // Do something here for landscape 

    } else {
        // Do something else for portrait
}

With Autolayout, you can do the following above, but have your bases covered fairly well without it being to painful. Does this help

Stone Preston
Stone Preston
42,016 Points

do you mean using a storyboard for one sized screen and another for the larger screen?

Nicholas Fox
Nicholas Fox
5,520 Points

That's exactly what I mean. Title and question edited for clarity.