qed
qed

Reputation: 23094

Leading space does not conform to constraint in interface builder

Here is a screenshot:

enter image description here

As you can see, the leading space to superview is set at 0, but there is a gap between the superview margin and the UIView. Why is that and how can I make the leading space really 0?

The same goes for trailing space, by the way.

Upvotes: 2

Views: 306

Answers (3)

tgyhlsb
tgyhlsb

Reputation: 1915

Select (double click) the constraint. Tap the selector for the superview item, and uncheck Relative to marginenter image description here

Upvotes: 3

Pragnesh Vitthani
Pragnesh Vitthani

Reputation: 2540

Pls, uncheck Constraint to margin Checkbox in Add New Constraints Dialog before give the Constraints like this :

enter image description here

Upvotes: 1

Bhavin Ramani
Bhavin Ramani

Reputation: 3219

I am sure that you have not uncheck Constrain to Margin checkbox while adding leading or trailing constraint.

Remove that constraint add it agin without checkbox:

enter image description here

OR

Select leading constraint and in size inspector remove check of Relative to margin in second item.

enter image description here

Upvotes: 1

Related Questions