• masonry中的make,remake,update


    - (void)viewDidLoad {
        [super viewDidLoad];
        self.navigationController.navigationBar.translucent = NO;
        
        UIView * redView = [[UIView alloc] init];
        redView.backgroundColor = [UIColor redColor];
        [self.view addSubview:redView];
        self.redView = redView;
        
        [redView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.view);
            make.trailing.equalTo(self.view);
            make.top.equalTo(self.view);
            make.height.equalTo(@30);
        }];
        
    //    [self make];
        [self update];
    //    [self remake];
    }
    
    -(void)make{
        // 之前已经设置了,再次make,无效
        [self.redView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.view);
            make.trailing.equalTo(self.view);
            make.top.equalTo(self.view);
            make.height.equalTo(@90);
        }];
    }
    
    -(void)update{
        //更新,之前有的没有更改的约束会保留,有变动的,更新约束
        [self.redView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.view).with.offset(50);
    //        make.trailing.equalTo(self.view);
    //        make.top.equalTo(self.view);
            make.height.equalTo(@90);
        }];
    }
    
    -(void)remake{
        //全部约束都再来设置,不会用之前有的,删除之前的约束,用心约束
        [self.redView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.view).with.offset(50);
            make.trailing.equalTo(self.view);
            make.top.equalTo(self.view);
            make.height.equalTo(@90);
        }];
    }
    
  • 相关阅读:
    线段拟合(带拉格朗日乘子,HGL)
    工作到位的标准
    Git的简单使用
    位移
    java日期格式化(util包下转成sql包下)
    java中继承的概念
    工作流驳回到指定连线节点上
    年终个人总结
    实现多条件查询 匹配数据库字段中多个数据
    activiti和SSH项目做整合
  • 原文地址:https://www.cnblogs.com/Jordandan/p/6307215.html
Copyright © 2020-2023  润新知