Autolayout: why are these same restrictions different from each other?
I am researching autorun. I am currently adding a simple constraint: 0px margin between view and superview.
There seem to be two ways to add this constraint:
First click on the bottom right button of your xib editor, select the left margin and click add n constraints like in this screenshot:
Here are the first properties of the constraint. It has a persistent 16px margin:
Second way, choose from the Xcode menu: Editor> Output> Lead Space to Watch:
Now my limit is 0px, but it works too: the view is well adapted to suit its superview
Here's my next constraint properties:
First question: why my first left and right margin is 16px ? I am working on a brand new project! If I set it to 0px there is extra space around my view!
Second question: what's the difference between these two restrictions? What's the best method?
thank
source to share
You have already answered. The limit for the supervisor is not the same as the limit for the supervisor token.
This might be easiest if you think about how to shape these constraints in code. Here are the attributes you can use:
As you can see, there are both Right and RightMargin. Snaps the right edge of the subview to its oversight. A rule is not the same as tying it to its right-to-right right.
source to share