Xcode auto layout constraints - why defaulting to negative padding?

非 Y 不嫁゛ 提交于 2019-12-21 09:08:11

问题


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?


回答1:


Uncheck "Constrain to margins" checkbox in the pin menu (the first image in the question) while adding spacing to nearest neighbor for the new constraints.



来源:https://stackoverflow.com/questions/25815396/xcode-auto-layout-constraints-why-defaulting-to-negative-padding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!