Autoresizing Masks

Hi all,

I was wondering what the difference between constraints and autoresizing masks is. I looked it up but can’t find much information.

Thanks,
UrAvgCoder

Hi @YourAvgCoder

I think the “Discussion” part of the Apple reference for the “translatesAutoresizingMaskIntoConstraints“ instance is quite explicite:

If this property’s value is true , the system creates a set of constraints that duplicate the behavior specified by the view’s autoresizing mask. This also lets you modify the view’s size and location using the view’s frame , bounds , or center properties, allowing you to create a static, frame-based layout within Auto Layout.
Note that the autoresizing mask constraints fully specify the view’s size and position; therefore, you cannot add additional constraints to modify this size or position without introducing conflicts. If you want to use Auto Layout to dynamically calculate the size and position of your view, you must set this property to false , and then provide a non ambiguous, nonconflicting set of constraints for the view.
By default, the property is set to true for any view you programmatically create. If you add views in Interface Builder, the system automatically sets this property to false .

Also, a good explanation on this online video:

1 Like