AutoLayout I
来源:互联网 发布:普通电脑装mac系统 编辑:程序博客网 时间:2024/05/18 01:47
//更新xib中约束的值
@interface HistoryMainViewController ()
@property (weak, nonatomic) IBOutletNSLayoutConstraint *lbl_cal_trailing;
@end
@implementation HistoryMainViewController
// 更新约束
- (void)updateViewConstraints{
[superupdateViewConstraints];
if (Model_style ==ModelStyleSleep) {
self.lbl_cal_trailing.constant =0;
}elseif (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);
}];
- AutoLayout I
- AutoLayout:忘掉Frame,拥抱Constraint(I)
- Autolayout
- autolayout
- AutoLayout
- autolayout
- AutoLayout
- autolayout
- AutoLayout
- autolayout
- autolayout
- autolayout
- AutoLayout
- Autolayout
- AutoLayout
- Autolayout
- AutoLayout
- autolayout
- JDBC useLocalSessionState
- uva 572 oil deposits——yhx
- Java 文件字符过滤流练习--银行卡信息系统(console)
- uva 816 abbott's revenge ——yhx
- setTransformationMethod 的使用
- AutoLayout I
- uva 10305 ordering tasks(超级烂题)——yhx
- uva 10129 play on words——yhx
- uva 10562 undraw the trees(烂题) ——yhx
- 【Java】类执行过程
- uva 12171 sculpture (超级好题)——yhx
- iOS8下,cell分割线右移
- uva 1572 self-assembly ——yhx
- uva 1599 ideal path(好题)——yhx