From the course: iOS Development: Auto Layout Programmatically
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Embed subviews - iOS Tutorial
From the course: iOS Development: Auto Layout Programmatically
Embed subviews
- [Instructor] In the spring rolls challenge, you used embedded stack views, which can go one step further than even that. In any view you can have embedded sub-views, with it's own auto layout in either constraints or visual format language. Well you know how to do the auto layout. Let's look at some of the quirks of embedding sub-views. Stop the app. And then head over to the PizzaView controller. We'll be working with this PizzaView controller. With code that's supposed to have the same layout as the spring rolls challenge, but it shows a pizza. I added two more methods to this code, addButtonView and addLabelView. To differentiate the subviews in your main view, you set your autolayout here, instead of the layoutviews as you did in spring rolls. Inside both is a very, very skeletalic view. In fact I have absolutely nothing in addButtonView. And just a little bit of code in addLabelView. This spring rolls examples use constants within layout to make it easier to modify in other…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.