1
votes

I'm trying to set up a basic storyboard using the Single View Application template in Xcode. The Main.storyboard has one view controller in it. I can add a subview and I can size it fill its parent view, but if I add autlayout constraints, it thinks that the leading and trailing edges need to be set to -16 to fill the screen. If I set them to 0, like I would expect to work, then it has a 16 point gap on the sides of the view.

Does anyone know why it insists on having constraints set to -16?

enter image description here

1
The concept of right and left "margins" are new at iOS 8. Interface defaults to them when adding top, leading, trailing and bottom margins.Aaron

1 Answers

7
votes

You've created constraints to the margins of the superview, not its edges. The edge of the view is 16 points from the margin.

This is new in Xcode 6. You can change this by altering the individual constraints (where it says the "item" as superview.margin or similar, in the attributes inspector) or by creating the constraints with the "use margins" box unchecked.