Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Cleaning up with Auto Layout
Your application has a usability issue: The user can resize the application window, but the instance of DieView will stay its original size. What you want is for the DieView to resize along with its superview. You can fix this with Auto Layout.
Auto Layout is a sophisticated system for controlling the layout of views in a window by applying constraints to views. You will learn more about Auto Layout and constraints in Chapter 25.
In this section, you are going to skip ahead and apply a constraint to make DieView resize with the window. The constraint will keep all four edges of the DieView exactly 20 points away from the edges of its superview (the content view of the window). Thus, when the window is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access