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);
        }];
    }
    
  • 相关阅读:
    4.7字符串
    4.5 基本类型和运算符
    4.4 变量
    4.6 字符串
    hp
    openstack newton linuxbridge 改成 ovs
    理解裸机部署过程ironic
    csredis base usage
    redisclient can not connect
    Linux Install redis
  • 原文地址:https://www.cnblogs.com/Jordandan/p/6307215.html
Copyright © 2011-2022 走看看