zoukankan      html  css  js  c++  java
  • 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);
        }];
    }
    
  • 相关阅读:
    HDU2059(龟兔赛跑)
    pat 1012 The Best Rank
    pat 1010 Radix
    pat 1007 Maximum Subsequence Sum
    pat 1005 Sign In and Sign Out
    pat 1005 Spell It Right
    pat 1004 Counting Leaves
    1003 Emergency
    第7章 输入/输出系统
    第六章 总线
  • 原文地址:https://www.cnblogs.com/Jordandan/p/6307215.html
Copyright © 2011-2022 走看看