How to remove margin from a viewController?

只愿长相守 提交于 2019-11-30 18:23:19

问题


I have created a new project using storyboard. Now, I want to add a UIView into the default ViewController. When I tried to add constraint using AutoLayout to the UIView with it's parent ViewController, it is showing -16 instead of 0 at both leading and trailing space. Which make the UIView smaller than the default UIViewController width. How could I remove this? Please help.


回答1:


just remove constraints to margin option ..




回答2:


to remove constrain margin from the constrain follow this step

1 . In Interface Builder, select an item by clicking it in the outline view or on the canvas

2 . Open the utilities area for the workspace window by clicking the Show Utilities button in the workspace configuration buttons in the toolbar. 

3 . In the inspector bar, click the Size Inspector button

4 . Scroll the inspector pane until you find the Constraints list

  1. To edit constraints, double–click a constraint in the list.

Xcode opens the constraint definition in the inspector.

6 . choose the item which has extension .margin

7 . Then remove the tick form Relative to margin

8 . Done



来源:https://stackoverflow.com/questions/31399330/how-to-remove-margin-from-a-viewcontroller

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