ios - Xcode 自动布局约束 - 为什么默认为负填充?

标签 ios xcode interface-builder autolayout nslayoutconstraint

我只是将 UIView 添加到 View Controller 的主视图中。我希望高度始终为 64px,但宽度要拉伸(stretch)到屏幕的宽度。

但是,当我去添加约束时,左右填充默认为 -16,即使 View 一直延伸到其父 View 。即使我将它们设置回 0,当我运行应用程序时,-16 填充也会重新添加。这是怎么回事?

enter image description here

enter image description here

enter image description here

最佳答案

取消选中固定菜单(问题中的第一张图片)中的“约束到边距”复选框,同时为新约束添加间距到最近的邻居

关于ios - Xcode 自动布局约束 - 为什么默认为负填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25815396/

相关文章:

cocoa - 如何将显示三角形的标题放在三角形的右侧?

iOS 应用程序 : UIButton tag not available in controller code

ios - 排毒 - 请求被服务委托(delegate) (PBProcessManager) 拒绝,原因为 : Security

xcode - 核心数据 - 无法将空字符串设置为属性的默认值

iphone - 如何设置 UINavigationBar 上后退按钮的文本?

objective-c - 按NSString将NSMutablearray排序为日期

xcode - MapKit 是否允许街景?

ios - 在父类(super class)中测试它是否是子类然后完成操作或将它们分开是更好的编程实践吗

ios - 无法使用 Swift 2 将空的数组数组转换为 JSON

ios - override init 和 required init 之间的区别? - swift