Search code examples
iosautolayoutstoryboard

Why constraints is always Zero,is Storyboard preventing from edges?


Let me trying to explain my question.I have noted from long time during app designing in Storyboard/Xib. In all cases for eg while dragging some controls into storyboard obviously it shows the blue lines helps to us place controls correctly.But it's seems prevent controls from UIView(main view) layout to place edges on controller.

When we trying to place controls the blue lines prevents us from edges.see below image

enter image description here

But why constraints always zero even we are not placed at edges..it should be approximately 10,10,10..,

enter image description here

So my Qus is

  1. Is Storyboard/Autolayout preventing to place controls at edges?
  2. If yes.Then why all constraints is Zero ?
  3. If No.Then what is the use of corner blue lines(eg:first image)?

Solution

  • They are the content margins of each view which are 8 points away from its actual borders. Please check this answer, which is explained it in details. Also you can place controls in the edges, just unchecking the constrain to margins will do that