Masonry
是一个轻量级的布局框架, 拥有自己的描述语法, 采用更优雅的链式语法封装自动布局 简洁明了 并具有高可读性。
下面总结了平时不常见的使用方法来深入认识一下Masonry
什么时候用Mas_
//以下两者完全一样
By default, macros which support autoboxing are prefixed with mas_.
Unprefixed versions are available by defining MAS_SHORTHAND_GLOBALS before importing Masonry.
Learn to prioritize
//2. mas_updateConstraints
Alternatively if you are only updating the constant value of the constraint you can use the convience method mas_updateConstraints instead of mas_makeConstraints
// this is Apple's recommended place for adding/updating constraints
// this method can get called multiple times in response to setNeedsUpdateConstraints
// which can be called by UIKit internally or in your code if you need to trigger an update to your constraints
网友评论