Embed a UIView with subviews into a stack view.
- [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 methods.…
I'm gonna make the two subviews properties.…
- When and why to use Auto Layout programmatically
- Creating constraints in Swift
- Resolving errors in Auto Layout
- Using the safe area
- Working with the Visual Format Language
- Adding a stack view
- Harnessing the power of inequalities and priorities in constraints
- Understanding traits and size classes
Skill Level Intermediate
Learning LayoutTest for iOS Developmentwith Kyle Sherman1h 43m Intermediate
Designing iOS and Android Appswith Renata Phillippi1h 6m Intermediate
1. Basic Concepts in Auto Layout
2. Coding Constraints
3. The Visual Format Language
4. Stack Views
5. Advanced Layout
6. Size Classes
Next steps1m 42s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.