Managing Constraints
All constraints belong to the NSLayoutConstraint class, regardless of how they are created. When working with constraints, you can add them to your views either one by one, using addConstraint:, or in arrays by using the addConstraints: instance method (notice the s at the end of the name). In day-to-day work, you often deal with collections of constraints that are stored in arrays.
A constraint always has a natural home in the nearest common ancestor of the views involved in the constraint. A constraint must be installed on a common ancestor of every view referenced. A self-installing category method on NSLayoutConstraint can programmatically determine the natural and correct view for installation. This is left as an exercise ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access