Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read log output of NSAutoresizingMaskLayoutConstraint?

I see the following output in console

"<NSAutoresizingMaskLayoutConstraint:0x100510500 h=--& v=&-- H:|-(0)-[NSView]
    (Names: NSView:0x1016ab760, '|':NSClipView:0x1016a26b0 )>
    (Actual Distance - pixels):0"

Normally I understand how to read log message for constraints. But autoresizingMask constraints always confuse me. How does the following characters in the log output correspond to auto-resizing mask?

h=--& v=&-- H:|-(0)-[NSView]

I watched several WWDC 2012 videos which didn't quite explain reading auto-resizing mask layout constraints.

like image 273
Tony Avatar asked Feb 23 '13 18:02

Tony


1 Answers

jrturton describes the first part of the debugging output in his answer (see the comments)

h=--& v=&--

The second part is the same for all autolayout constraints:

H:|-(0)-[NSView]

This is just giving details on how the mask got turned into a constraint. "H" means horizontal, the "|" means the container your view is in (in this case an NSClipView), the -(0)- means that it's constrained to be 0 pixels on the left of your view (in this case a generic NSView).

So a constrain got added bonding the view's left edge directly to its superview. (Since the right edge is unconstrained it'll flop around in the breeze, just like the autoresizing mask says.)

like image 136
Wil Shipley Avatar answered Oct 22 '22 22:10

Wil Shipley