I've been working through Matt Nueberg's Programming iOS 7 book and am struggling to understand something with the direction of constraints. On page 28 of the book, in the multiplier, constant
section, the author states:
The first attribute is set to the result.
So the way I read this, is that when there is a two item constraint, item 1 is derived or dependent based on the value of item 2.
So I have a view and a subview (button), I want to center the button horizontally. So I arrange my view and button and then control-drag from the button to the parent view:
and select Center Horizontally
:
Then if I select that constraint though, I see the following in the attributes inspector at the right:
This shows the superview as item 1, and the button as item 2. Does this mean, that it would try to adjust the center of the superview to match the center of the button? That wouldn't be what I want. Or am I misunderstanding the meaning of item 1 and item 2? Or does it mean that I did the control-drag backwards, that you're supposed to drag from the dependency to the dependent, rather than the dependent to the dependency as I did?
I assume the order does matter, that is, which is item 1 and which is item 2. Because there's a menu option to swap the two. And if it were just a solver with no preference for what was adjusted, that wouldn't be necessary.