AutoLayout I

// 更新xib中约束的值

@interface HistoryMainViewController ()

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *lbl_cal_trailing;

@end


@implementation HistoryMainViewController

// 更新约束

- (void)updateViewConstraints{

    [super updateViewConstraints];

    

    if (Model_style == ModelStyleSleep) {

        self.lbl_cal_trailing.constant = 0;

    }else if (Model_style == ModelStyleSport){

        self.lbl_cal_trailing.constant = -40;

    }

}

@end





[bgView_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.leading.equalTo(self.view.mas_leading).with.offset(0);

        make.top.equalTo(self.view.mas_top).with.offset(0);

        make.height.mas_equalTo(SCREEN_HEIGHT);

        make.width.mas_equalTo(SCREEN_WIDTH);

    }];

    

    // logoView

    [logoView_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.mas_equalTo(self.view.mas_centerX);

        make.top.equalTo(self.view.mas_top).with.offset(50);

        make.height.mas_equalTo(SCREEN_HEIGHT *0.24);

        make.width.mas_equalTo(SCREEN_HEIGHT *0.24 * 1.14);

    }];

    

    int loginViewHeight = SCREEN_HEIGHT * 0.14;

    // loginView

    [loginView_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.leading.equalTo(self.view.mas_leading).with.offset(0);

        make.trailing.equalTo(self.view.mas_trailing).with.offset(0);

        make.height.mas_equalTo(loginViewHeight);

        make.top.equalTo(logoView_.mas_bottom).with.offset(SCREEN_HEIGHT * 0.08);

    }];

    // user

    [userView_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(loginView_.mas_top).with.offset(loginViewHeight / 4 - 10);

        make.leading.equalTo(loginView_.mas_leading).with.offset(30);

        make.width.mas_equalTo(23);

        make.height.mas_equalTo(22);

    }];

    [userText_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(userView_.mas_top).with.offset(0);

        make.leading.equalTo(userView_.mas_trailing).with.offset(15);

        make.width.mas_equalTo(250);

        make.height.mas_equalTo(22);

    }];

    // seperateLabel

    [sepLabel_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.mas_equalTo(self.view.mas_centerX);

        make.top.equalTo(loginView_.mas_top).with.offset(loginViewHeight / 2);

        make.leading.equalTo(loginView_.mas_leading).with.offset(20);

        make.height.mas_equalTo(1);

    }];

    // password

    [pwdView_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(loginView_.mas_top).with.offset(loginViewHeight * 0.75 - 10);

        make.leading.equalTo(userView_.mas_leading).with.offset(0);

        make.width.mas_equalTo(23);

        make.height.mas_equalTo(22);

    }];

    [pwdText_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(pwdView_.mas_top).with.offset(0);

        make.leading.equalTo(pwdView_.mas_trailing).with.offset(15);

        make.width.mas_equalTo(250);

        make.height.mas_equalTo(22);

    }];

    

    // forgotPwdButton

    [forgotPwdBtn_mas_makeConstraints:^(MASConstraintMaker *make) {

        make.trailing.equalTo(self.view.mas_trailing).with.offset(25);

        make.top.equalTo(loginView_.mas_bottom).with.offset(8);

        make.width.mas_equalTo(160);

        make.height.mas_equalTo(20);

    }];

    

    // loginButton

    [loginBtn_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.leading.equalTo(self.view.mas_leading).with.offset(0);

        make.trailing.equalTo(self.view.mas_trailing).with.offset(0);

        make.height.mas_equalTo(SCREEN_HEIGHT *0.07);

        make.top.equalTo(loginView_.mas_bottom).with.offset(SCREEN_HEIGHT * 0.08);

    }];

    

    //loginTipsView

    [loginTipsView_mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.mas_equalTo(self.view.mas_centerX);

        make.top.equalTo(loginBtn_.mas_bottom).with.offset(SCREEN_HEIGHT * 0.04 + 8);

        make.leading.equalTo(self.view.mas_leading).with.offset(20);

        make.height.mas_equalTo(1);

    }];

    

    // loginTipsLabel

    [loginTipsLbl_mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.mas_equalTo(self.view.mas_centerX);

        make.top.equalTo(loginBtn_.mas_bottom).with.offset(SCREEN_HEIGHT * 0.04);

        make.width.mas_equalTo(160);

        make.height.mas_equalTo(16);

    }];

    

    // qqButton

    [qqBtn_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(loginTipsLbl_.mas_bottom).with.offset(SCREEN_HEIGHT * 0.05);

        make.leading.equalTo(self.view.mas_leading).with.offset(SCREEN_WIDTH * 0.28);

        make.width.mas_equalTo(30);

        make.height.mas_equalTo(30);

    }];

    

    // weixinButton

    [wxBtn_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(loginTipsLbl_.mas_bottom).with.offset(SCREEN_HEIGHT * 0.05);

        make.trailing.equalTo(self.view.mas_trailing).with.offset(-SCREEN_WIDTH * 0.28);

        make.width.mas_equalTo(30);

        make.height.mas_equalTo(30);

    }];

    

    // registView

    [registView_ mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.mas_equalTo(self.view.mas_centerX);

        make.top.equalTo(qqBtn_.mas_bottom).with.offset(SCREEN_HEIGHT * 0.04);

        make.width.mas_equalTo(165);

        make.height.mas_equalTo(30);

    }];

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值