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

Individual layout per device

Hello everyone

So I have finished "Build a Simple iPhone App with Swift 3" course and I wanted to play a bit. I decided to make a slightly different version of "Fun Fact" app. I have now just one label, but six different buttons (each one represents a different group of facts - historical facts, political facts etc). The problem is that even if I do my best, 4.7 inch devices are the last ones where the layout isn't broken. I just can't make it work for smaller devices (and even on 4.7 inch devices it's so close it doesn't look good.

So I want to ask - is it possible to (make an auto layout and then) adjust layout depending on device/device screen size?

1 Answer

eberhapa
eberhapa
51,495 Points

Well, this is an interesting topic and there are some videos for this at treehouse. To differentiate between different devices the keyword is "size classes". Some links down below:

You will also find tones of videos and explanations on youtube.

An other possibility if you have not enough space for placing your buttons is using a static UITableView or a UIScrollView but it always depends on what you exactly want to do.

I recommend going trough all videos related to swift on treehouse to get familiar with all possibilities and afterwords start creating your own stuff and playing around because you will get familiar with different keywords and it will be easier for you to search on the internet. Stackoverflow is also always a good point to search :)

Hope i could help you a little bit.

Best, Patrick

Sorry for late answer and thank you for help! :)

Cheers, Johnny