In iOS 8 you now have the option to define your constrains relative to a predefined margin to the superview's bounds, instead of the superview's bounds themselves. Yes, it is totally related to the layout margins you pointed to in the docs. One advantage is that you may redefine your margins dynamically, or differently for each kind of device, and the layout will be updated correspondingly without modifying the constraints.When to use it: when you want to take advantage of this new flexibility.When to NOT use it: for any app targeted to run on iOS 7 or below.
这个是从官方文档上考下来的,意思是说iOS8默认多了个margin,你可以通过设置margin来控制默认的缝隙。
在设置约束时要将
Constrain to margins
选项的勾去掉,这样可以避免view产生内边距:
http://demo.netfoucs.com/growinggiant/article/details/42002871
iOS8里加入了layoutMargins属性,如果选中Constrain to margins
,则会依照layoutMargins的位置作为起点来进行约束。
下面那个update frame 的意思是在更改约束后要不要刷新页面已显示View正确所处的位置。你实际用一下,会发现选none,则添加或更改约束后,view不会改变位置,同时显示黄色线条,代表view目前不在正确的位置上。而如果你选择了其他两个,则相应的会刷新view到正确的位置。