Review UIViews and learn how to use them in Swift Playgrounds.
- [Instructor] Before we look at Auto Layout…programmatically,…let's look at two fundamental concepts in UIKit…that you need to know before working in Auto Layout.…Everything in UIKit is based on views.…Stop the app if you have it running.…Open up the CoffeeViewController.…UIViewControllers have a property view.…We refer to this view as the superview.…It contains all other views.…We add into the view, subviews using the method addSubview.…
You'll see several of these in the code for addImageView,…addLabel,…and add the buttons.…Drop down farther in the code,…and you'll see the layoutViews method.…I've added some code there.…Each view has a property frame.…
Frames are rectangles defined by the type CGRect.…You need an origin and a size for any CGRect.…The origin is the point where the top left corner…will appear on the view.…The size is the height and width of the rectangle.…You can assign a point and a size to a rect,…like I did here for the imageView.…So I have origin is 0, 0,…and the size is width 300, height 300 points.…
- 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
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.