2. Constraints

Auto Layout is a constraint satisfaction system. The word constraint means “limitation” or “restriction.” Each rule you build creates a requirement about how one part of the interface relates with another. You rank these rules using a numeric priority, and Auto Layout builds your interface’s visual presentation based on your rules and ranking. In this chapter, you will read about constraints in depth—what they are and how to specify them. You will learn about the kinds of constraints used in Auto Layout, how to install constraints in the system, and how priorities affect your results.

Constraint Types

Auto Layout centers on several core constraint classes:

Layout constraints (NSLayoutConstraint class, public)—These rules specify ...

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