发表于: 2019-10-22 20:40:34

2 370


今日完成:


使用Masonry代替AutoLayout

    CGFloat padding=50;
    [phoneField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(3*padding);
        make.left.mas_equalTo(padding);
        make.right.mas_equalTo(-padding);
    }];
    [passwdField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(phoneField.mas_bottom).offset(padding);
        make.left.mas_equalTo(padding);
        make.right.mas_equalTo(-padding);
    }];
    [loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(passwdField.mas_bottom).offset(padding);
        make.left.mas_equalTo(padding);
        make.right.mas_equalTo(-padding);
    }];
    
    [forgetButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-padding);
        make.left.mas_equalTo(padding);
    }];
    
    [rigisterButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-padding);
        make.right.mas_equalTo(-padding);
    }]; 

代码量确实少了。


今天划水了,感觉不太适合学移动端了。

还是回去学前端吧。





返回列表 返回列表
评论

    分享到