I guess they must refer to the struts and springs model but I can't find any mention of them. When you NSLog
constraint they sometimes appear as the description string of the undocumented class NSAutoresizingMaskLayoutConstraint
. I have noticed at least 3 different types: h=---
, h=--&
, h=-&-
with horizontal and vertical version.
They turn up a lot when debugging over constrained layouts.
An integer bit mask that determines how the receiver resizes itself when its superview's bounds change.
If you specify autoresizing masks instead of constraints, or specify no constraints at all, then the view will have NSAutoResizingMaskLayoutConstraint constraints as opposed to NSLayoutConstraints. If you set translatesAutoresizingMaskIntoConstraints
to NO
, then these constraints do not appear. You can't mix and match on a single view, or you get unsatisfiable constraint errors.
I set up a quick test project with various combinations of autoresizing masks and the logging format is pretty straightforward.
h=
or v=
indicates that we are talking about contraints in the horizontal or vertical direction.-
indicates a fixed size&
indicates a flexible sizeTherefore, h=&-&
means you have flexible left and right margins and a fixed width, v=-&-
means fixed top and bottom margins and flexible height, and so forth.
If you watch the WWDC 2012 video on Best Practices for Mastering Auto Layout, there is a section in there where the presenter mentions that this is the syntax for views that use Autoresizing Masks and NOT constraints. There's no visual format associated with these like there is for NSLayoutConstraint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With