This chapter introduces the core concepts that underpin Auto Layout, Cocoa’s declarative constraint-based descriptive layout system. You have learned that Auto Layout focuses on the relationships between views and between views and their content—instead of on their frames. A logical priority-based framework drives Auto Layout. You have discovered that its rules must be satisfiable, consistent, and sufficient. Here are a few final thoughts to take away from this chapter:
- Constraints are fun and powerful. They provide elegant solutions to common layout situations.
- Don’t be afraid to mix and match Auto Layout and Autosizing. As long as rules do not conflict, you can port existing layouts to the new Auto Layout world.
- Auto Layout is more than just constraints. Its content-protecting features provide a key component that helps specify what to show—and not just where to show it. For example, compression resistance and content hugging adapt graphical user interfaces (GUIs) during internationalization, allowing you to easily accommodate differing label sizes when languages change.
- Auto Layout is essentially a linear equation solver that attempts to find a satisfiable geometric expression of its rules. When its equations produce too many solutions, you end up with underconstrained ambiguous layout. When its equations cannot produce any solution, you know that constraints are in conflict.