Add a stack view to a new page. Learn how to auto-layout a stack view.
- [Instructor] There are some layouts…that take just too many constraints.…Think of a keyboard with dozens of buttons…or a menu selection in a single row.…These are cases where instead of using auto layout directly…you used stack views.…Stack views are arrays of views…that auto layout makes the constraints for you,…stacking one on top of the other or next to each other.…Let's explore a stack view.…Go ahead and stop the app.…Head over to the Maki Rolls layout views.…
Once again it's nice and blank again.…And add this one line of code.…Let stackView equal UIStackView,…parenthesis, and you'll find one…that says arranged subviews.…Go ahead and pick that one.…Now the stack view is a special view of class UI stack view.…It's initializer has a parameter of arranged subviews,…which is an array of UI views.…
I'll make an array above this like the stack view.…So we're gonna do let subviews…and that will be an array of UIView,…and I'll put four of our views in here.…So I'll put imageView,…orderButton,…backButton,…and label.…
Then I'll add that to the stack view.…
- 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.