Disabling Autoresizing Constraints

Autoresizing refers to the struts-and-springs layout tools used in IB and to the autoresizing flags, like UIViewAutoresizingFlexibleWidth, used in code. When you lay out a view’s resizing behavior with these approaches, that view should not be referred to in any constraints you define.

When you move into the constraints world, you start by disabling a view property that automatically translates autoresizing masks into constraints. As a rule, you either enable this, allowing the view to participate in the constraint system via its autoresizing mask, or you disable it entirely and manually add your own constraints.

The constraints-specific property in question is translatesAutoresizingMaskInto-Constraints. Setting ...

Get The Core iOS Developer’s Cookbook, Fifth 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.