简体   繁体   中英

Xcode auto layout constraints - why defaulting to negative padding?

I am simply adding a UIView into the main view of a view controller. I want the height to always be 64px, but the width to stretch to the width of the screen.

However, when I go to add constraints, the left and right padding default to -16, even though the view is stretched all the way across its parent view. Even if I set these back to 0, when I run the app the -16 padding is added back in. What is going on here?

在此输入图像描述

在此输入图像描述

在此输入图像描述

取消选中pin菜单中的“Constrain to margins”复选框 (问题中的第一个图像),同时为新约束添加间隔到最近邻居

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM