2. Constraints

With Auto Layout, you build interfaces by declaring rules about views. Each layout rule you add creates a requirement about how part of the interface should be laid out. These rules are ranked based on a numeric priority that you supply to the system, and Auto Layout builds your interface’s visual presentation accordingly.

Auto Layout is essentially a constraint satisfaction system. The word constraint means a limitation or restriction. The rules you build restrict how elements may be placed onscreen. As you read in Chapter 1, “Introducing Auto Layout,” these rules must be sufficient to fully describe the interface and unambiguously satisfiable so that any rules that are in conflict with each other can be resolved by comparing ...

Get iOS Auto Layout Demystified 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.