mrgrieves
mrgrieves

Reputation: 579

Putting a UIViewController in a XIB makes constraints disagree with frame

Immediate children of the UIViewController's view outlet have a weird 16pt horizontal padding in constraint space but not frame space.

  1. Add a UIViewController to a XIB file in Xcode 6
  2. Add a subview to the UIViewController's view
  3. Stretch the subview so that its leading and trailing edges touch the superview
  4. Click on the pinning constraints button
  5. Observe that IB wants to add -16pt distances from the subview to its superview

Where is this discrepancy coming from? How can I get my subview to stay constrained to the superview's edges?

enter image description here

Upvotes: 0

Views: 172

Answers (1)

Peter Heide
Peter Heide

Reputation: 519

In the pin constraints popover, uncheck "Constrain to margins".

There is some more discussion of this feature here: What is "Constrain to margin" in Storyboard in Xcode 6

Upvotes: 2

Related Questions