【问题标题】:Sometime there is an extra spacing(margin) in Xcode 8 (auto layout), why?有时 Xcode 8(自动布局)中有一个额外的间距(边距),为什么?
【发布时间】:2017-08-07 07:42:37
【问题描述】:
我放置了一个视图并将其尾随设置为 0 间距的超级视图,但有一个额外的间距。我不知道为什么会发生这种情况,我清除了约束并添加了新的约束,但空间仍然存在。是否有错误,或者我错过了什么?
【问题讨论】:
标签:
ios
xcode
swift3
xcode8
【解决方案1】:
这是因为Constraint to margins。布局边距表示布局系统在布局子视图时可以使用的 UIView 内部的填充 - 以确保在视图边缘和子视图之间留有间隙。
您可以通过在添加约束时取消选中 Constraint to margins 来避免这种情况。