Intrinsic Content Size

In the constraints that you have added, you at no point specified a minimum width for the Add Employee button. However, when you try to shrink the width of the window, the scroll view reaches its minimum width, but the Add Employee button’s width stays the same! This is happening because Auto Layout is taking the button’s intrinsic content size into consideration. In the case of a button, its intrinsic content size is determined by its title text.

Auto Layout handles changes to intrinsic content size as well. If you changed the Add Employee button’s title to something longer, the window would be laid out again so that the button’s new title could be displayed fully. It would first shrink the scroll view, and, ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.