O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required