Learn the options for the Distributions property and the differences to appearance.
- [Instructor] Alignment sets spacing…and alignment perpendicular to the axis.…Distribution sets spacing along the axis.…Though this is a bit more subtle than alignment.…Stop the app.…And take a look at the code for the stack view.…Like fill on the alignment,…fillEqually is the basic automatic mode.…It creates constraints that pin each subview to each other…and sets the size to be equal for all the subviews.…For a vertical axis that's the height,…for a horizontal the width.…
Currently the subviews are flush with one another.…You can add space with the spacing property of UIStackView.…Under distribution here,…add this line.…StackView.spacing…equals 10.…Go ahead and run the app.…Hit Maki Rolls and you'll see you're getting it…at a spacing of 10 between each one of our elements.…
Now you can also get unequal spacing,…and that's a method called setCustomSpacingAfter.…You can go ahead and stop this.…And I'm gonna do another stack view…dot, and this is gonna be setCustomSpacing…with a CGFLoat after UI view.…And we'll do spacing of 20 between backButton and label.…
- 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.