• Masonry 布局 基本操作 小结


    呐,Masonry 是用来布局的!CocoaPods上下载!

    呐,来吧!开始鸟语......下面是从View+MASAdditions.h中抽出来的方法。

     1 /**
     2  *  Creates a MASConstraintMaker with the callee view.
     3  *  Any constraints defined are added to the view or the appropriate superview once the block has finished executing
     4  *
     5  *  @param block scope within which you can build up the constraints which you wish to apply to the view.
     6  *
     7  *  @return Array of created MASConstraints
     8  */
     9 - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block;
    10 
    11 /**
    12  *  Creates a MASConstraintMaker with the callee view.
    13  *  Any constraints defined are added to the view or the appropriate superview once the block has finished executing.
    14  *  If an existing constraint exists then it will be updated instead.
    15  *
    16  *  @param block scope within which you can build up the constraints which you wish to apply to the view.
    17  *
    18  *  @return Array of created/updated MASConstraints
    19  */
    20 - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block;
    21 
    22 /**
    23  *  Creates a MASConstraintMaker with the callee view.
    24  *  Any constraints defined are added to the view or the appropriate superview once the block has finished executing.
    25  *  All constraints previously installed for the view will be removed.
    26  *
    27  *  @param block scope within which you can build up the constraints which you wish to apply to the view.
    28  *
    29  *  @return Array of created/updated MASConstraints
    30  */
    31 - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block;

    土鳖式翻译开始...  对比:

    mas_makeConstraints     created
    mas_updateConstraints    created/updated   If an existing constraint exists then it will be updated instead.
                              (如果现有的约束存在,那么它将被更新。)
    mas_remakeConstraints    created/updated  All constraints previously installed for the view will be removed.
                              (视图上之前安装的所有约束将被删除。人家的意思是会保留最新哒) 

    简单使用方法:

    人家想来个全屏的么,除了导航栏。

    1  [myView mas_makeConstraints:^(MASConstraintMaker *make) {
    2         make.top.equalTo(self.view.mas_top).with.offset(64);//
    3         make.left.equalTo(self.view.mas_left);    //
    4         make.right.equalTo(self.view.mas_right);//
    5         make.bottom.equalTo(self.view.mas_bottom);//
    6     }];

    其他方法自行脑补~揍四Autolayout。

    下面贴个详细的帖子,I like   ~~~  http://adad184.com/2014/09/28/use-masonry-to-quick-solve-autolayout/

    
    
    
  • 相关阅读:
    HTML <h1>
    HTML <body> 标签
    如何挑选深度学习 GPU?
    视频动作定位的分层自关注网络:ICCV2019论文解析
    三维点云去噪无监督学习:ICCV2019论文分析
    摄像头定位:ICCV2019论文解析
    深度学习扫地机器人
    细粒度语义分割:ICCV2019论文解析
    目标形体形状轮廓重建:ICCV2019论文解析
    2-2.5-3D的室内场景理解
  • 原文地址:https://www.cnblogs.com/hanyutong/p/4770998.html
Copyright © 2020-2023  润新知