62.在设置autolayout时候 constrain to margins 和 Update Frames 这两项是什么意思?



 62.在设置autolayout时候 constrain to margins 和 Update Frames 这两项是什么意思? - 蝶飞花已醉 - 蝶飞花已醉的博客

  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到正确的位置。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值