Get introduced to auto layout and constraints in Xcode playgrounds. Use the basic constraint to layout the two views.
- [Narrator] You've been introduced to Auto Layout,…you can use Auto Layout in your Playground…if you need to have automatic sizing…of the Playground's live view.…As we've discussed, we don't have interface builder.…So we have to do it in code.…There's two ways to do Auto Layout in code,…and I tend to use the more verbose,…but explicit way of listing every constraint.…I'll save you some typing, and if you load the file…for this chapter, you'll find the code added for you.…So close the Xcode project, and the playground.…
Load the new version.…I'll just describe it as I go along.…Before we use Auto Layout, we have to turn off a feature…that conflicts with Auto Layout…and that is the "translatesAutoresizingMaskIntoConstraints"…so we turn those to false,…and you need to do that for each view.…If you don't, it probably will not work.…Under that, I've set up an array of constraints,…and I will put all my constraints in this array.…
Each element of this constraint…will be a "NSLayoutConstraint".…You set it up with an "init"…
- Comparing iPad and Xcode playgrounds
- Creating and testing Swift classes and code in iPad and Xcode playgrounds
- Prototyping code
- Debugging and testing with Quick Look live views
- Using markup to interactively document code and create educational lessons
- Compiling code into playground books
Skill Level Intermediate
1. Introducing Playgrounds
2. Xcode Playgrounds
3. iPad Playgrounds
4. Markup and Playgrounds
5. Playground Books
- 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.