有时在Xcode 8(自动布局)中有一个额外的间距(边距),为什么?

时间:2017-08-07 07:42:37

标签: ios xcode swift3 xcode8

我放置一个视图并将其尾部设置为具有0间距的超视图,但是有一个额外的间距。我不知道为什么会发生这种情况,我清除了约束并添加了新的约束,但空间仍然存在。有没有错误,或者我错过了什么?

enter image description here

1 个答案:

答案 0 :(得分:2)

这是因为Constraint to margins。布局边距表示布局系统在布置子视图时可以使用的UIView内部周围的填充 - 以确保在视图边缘和子视图之间留有间隙。

您可以在添加约束时取消选中Constraint to margins来避免这种情况。

enter image description here