美文网首页
Masonry 使用技巧

Masonry 使用技巧

作者: 夏楷泉 | 来源:发表于2019-07-07 00:33 被阅读0次

    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


    如何使用

    相关文章

      网友评论

          本文标题:Masonry 使用技巧

          本文链接:https://www.haomeiwen.com/subject/wudvhctx.html