Masonry手码布局
2016-01-31 19:48
330 查看
//底部背景
UIView *view = [[UIView
alloc] init];
view.backgroundColor = [UIColor
whiteColor];
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(WJScreenWidth,
180));
make.left.equalTo(cover).with.offset(0);
make.right.equalTo(cover).with.offset(0);
make.bottom.equalTo(cover).with.offset(0);
}];
//标题
UILabel *titleLabel = [[UILabel
alloc] init];
titleLabel.text =
@"交易类型";
titleLabel.font = [UIFont
systemFontOfSize:17.0];
[titleLabel setTextColor:[UIColor
blackColor]];
//分割线
UIView *divideLine = [[UIView
alloc] init];
[divideLine setBackgroundColor:WJAppTransactionDivideColor];
//全部
UIButton *allBtn = [[UIButton
alloc] init];
[allBtn setTitle:@"全部"
forState:UIControlStateNormal];
allBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[allBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[allBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[allBtn addTarget:self
action:@selector(clickAll:)
forControlEvents:UIControlEventTouchUpInside];
//充值
UIButton *rechargeBtn = [[UIButton
alloc] init];
[rechargeBtn setTitle:@"充值"
forState:UIControlStateNormal];
rechargeBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[rechargeBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[rechargeBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[rechargeBtn addTarget:self
action:@selector(clickRecharge:)
forControlEvents:UIControlEventTouchUpInside];
//提现
UIButton *withdrawlBtn = [[UIButton
alloc] init];
[withdrawlBtn setTitle:@"提现"
forState:UIControlStateNormal];
withdrawlBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[withdrawlBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[withdrawlBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[withdrawlBtn addTarget:self
action:@selector(clickWithdrawal:)
forControlEvents:UIControlEventTouchUpInside];
//撤资回款
UIButton *withdrawInterestPaymentBtn = [[UIButton
alloc] init];
[withdrawInterestPaymentBtn setTitle:@"撤资回款"
forState:UIControlStateNormal];
withdrawInterestPaymentBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[withdrawInterestPaymentBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[withdrawInterestPaymentBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[withdrawInterestPaymentBtn addTarget:self
action:@selector(clickWithdrawInterestPayment:)
forControlEvents:UIControlEventTouchUpInside];
//购买理财
UIButton *buyFinancialBtn = [[UIButton
alloc] init];
[buyFinancialBtn setTitle:@"购买理财"
forState:UIControlStateNormal];
buyFinancialBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[buyFinancialBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[buyFinancialBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[buyFinancialBtn addTarget:self
action:@selector(clickBuyFinancial:)
forControlEvents:UIControlEventTouchUpInside];
//本息回款
UIButton *thePrincipalAndInterestPaymentBtn = [[UIButton
f208
alloc] init];
[thePrincipalAndInterestPaymentBtn setTitle:@"本息回款"
forState:UIControlStateNormal];
thePrincipalAndInterestPaymentBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[thePrincipalAndInterestPaymentBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[thePrincipalAndInterestPaymentBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[thePrincipalAndInterestPaymentBtn addTarget:self
action:@selector(clickThePrincipalAndInterestPayment:)
forControlEvents:UIControlEventTouchUpInside];
[view addSubview:titleLabel];
[view addSubview:divideLine];
[view addSubview:allBtn];
[view addSubview:rechargeBtn];
[view addSubview:withdrawlBtn];
[view addSubview:withdrawInterestPaymentBtn];
[view addSubview:buyFinancialBtn];
[view addSubview:thePrincipalAndInterestPaymentBtn];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(view.mas_top).with.offset(15);
make.centerX.equalTo(view.mas_centerX);
make.height.equalTo(@20);
}];
[divideLine mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(titleLabel.mas_bottom).with.offset(15);
make.left.equalTo(view.mas_left).with.offset(0);
make.right.equalTo(view.mas_right).with.offset(0);
make.width.equalTo(view.mas_width).with.offset(0);
make.height.equalTo(@1);
}];
[allBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(divideLine.mas_bottom).with.offset(0);
make.left.equalTo(view.mas_left).with.offset(0);
make.right.equalTo(rechargeBtn.mas_left).with.offset(0);
make.bottom.equalTo(withdrawInterestPaymentBtn.mas_top).with.offset(0);
make.height.equalTo(@90);
}];
[rechargeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(divideLine.mas_bottom).with.offset(0);
make.left.equalTo(allBtn.mas_right).with.offset(0);
make.right.equalTo(withdrawlBtn.mas_left).with.offset(0);
make.bottom.equalTo(buyFinancialBtn.mas_top).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
[withdrawlBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(divideLine.mas_bottom).with.offset(0);
make.left.equalTo(rechargeBtn.mas_right).with.offset(0);
make.right.equalTo(view.mas_right).with.offset(0);
make.bottom.equalTo(thePrincipalAndInterestPaymentBtn.mas_top).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
[withdrawInterestPaymentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(allBtn.mas_bottom).with.offset(0);
make.left.equalTo(view.mas_left).with.offset(0);
make.right.equalTo(buyFinancialBtn.mas_left).with.offset(0);
make.bottom.equalTo(view.mas_bottom).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
[buyFinancialBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(rechargeBtn.mas_bottom).with.offset(0);
make.left.equalTo(withdrawInterestPaymentBtn.mas_right).with.offset(0);
make.right.equalTo(thePrincipalAndInterestPaymentBtn.mas_left).with.offset(0);
make.bottom.equalTo(view.mas_bottom).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
[thePrincipalAndInterestPaymentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(withdrawlBtn.mas_bottom).with.offset(0);
make.left.equalTo(buyFinancialBtn.mas_right).with.offset(0);
make.right.equalTo(view.mas_right).with.offset(0);
make.bottom.equalTo(view.mas_bottom).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
UIView *view = [[UIView
alloc] init];
view.backgroundColor = [UIColor
whiteColor];
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(WJScreenWidth,
180));
make.left.equalTo(cover).with.offset(0);
make.right.equalTo(cover).with.offset(0);
make.bottom.equalTo(cover).with.offset(0);
}];
//标题
UILabel *titleLabel = [[UILabel
alloc] init];
titleLabel.text =
@"交易类型";
titleLabel.font = [UIFont
systemFontOfSize:17.0];
[titleLabel setTextColor:[UIColor
blackColor]];
//分割线
UIView *divideLine = [[UIView
alloc] init];
[divideLine setBackgroundColor:WJAppTransactionDivideColor];
//全部
UIButton *allBtn = [[UIButton
alloc] init];
[allBtn setTitle:@"全部"
forState:UIControlStateNormal];
allBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[allBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[allBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[allBtn addTarget:self
action:@selector(clickAll:)
forControlEvents:UIControlEventTouchUpInside];
//充值
UIButton *rechargeBtn = [[UIButton
alloc] init];
[rechargeBtn setTitle:@"充值"
forState:UIControlStateNormal];
rechargeBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[rechargeBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[rechargeBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[rechargeBtn addTarget:self
action:@selector(clickRecharge:)
forControlEvents:UIControlEventTouchUpInside];
//提现
UIButton *withdrawlBtn = [[UIButton
alloc] init];
[withdrawlBtn setTitle:@"提现"
forState:UIControlStateNormal];
withdrawlBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[withdrawlBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[withdrawlBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[withdrawlBtn addTarget:self
action:@selector(clickWithdrawal:)
forControlEvents:UIControlEventTouchUpInside];
//撤资回款
UIButton *withdrawInterestPaymentBtn = [[UIButton
alloc] init];
[withdrawInterestPaymentBtn setTitle:@"撤资回款"
forState:UIControlStateNormal];
withdrawInterestPaymentBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[withdrawInterestPaymentBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[withdrawInterestPaymentBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[withdrawInterestPaymentBtn addTarget:self
action:@selector(clickWithdrawInterestPayment:)
forControlEvents:UIControlEventTouchUpInside];
//购买理财
UIButton *buyFinancialBtn = [[UIButton
alloc] init];
[buyFinancialBtn setTitle:@"购买理财"
forState:UIControlStateNormal];
buyFinancialBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[buyFinancialBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[buyFinancialBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[buyFinancialBtn addTarget:self
action:@selector(clickBuyFinancial:)
forControlEvents:UIControlEventTouchUpInside];
//本息回款
UIButton *thePrincipalAndInterestPaymentBtn = [[UIButton
f208
alloc] init];
[thePrincipalAndInterestPaymentBtn setTitle:@"本息回款"
forState:UIControlStateNormal];
thePrincipalAndInterestPaymentBtn.titleLabel.font = [UIFont
systemFontOfSize:14.0];
[thePrincipalAndInterestPaymentBtn setTitleColor:[UIColor
blackColor] forState:UIControlStateNormal];
[thePrincipalAndInterestPaymentBtn setTitleColor:[UIColor
redColor] forState:UIControlStateSelected];
[thePrincipalAndInterestPaymentBtn addTarget:self
action:@selector(clickThePrincipalAndInterestPayment:)
forControlEvents:UIControlEventTouchUpInside];
[view addSubview:titleLabel];
[view addSubview:divideLine];
[view addSubview:allBtn];
[view addSubview:rechargeBtn];
[view addSubview:withdrawlBtn];
[view addSubview:withdrawInterestPaymentBtn];
[view addSubview:buyFinancialBtn];
[view addSubview:thePrincipalAndInterestPaymentBtn];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(view.mas_top).with.offset(15);
make.centerX.equalTo(view.mas_centerX);
make.height.equalTo(@20);
}];
[divideLine mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(titleLabel.mas_bottom).with.offset(15);
make.left.equalTo(view.mas_left).with.offset(0);
make.right.equalTo(view.mas_right).with.offset(0);
make.width.equalTo(view.mas_width).with.offset(0);
make.height.equalTo(@1);
}];
[allBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(divideLine.mas_bottom).with.offset(0);
make.left.equalTo(view.mas_left).with.offset(0);
make.right.equalTo(rechargeBtn.mas_left).with.offset(0);
make.bottom.equalTo(withdrawInterestPaymentBtn.mas_top).with.offset(0);
make.height.equalTo(@90);
}];
[rechargeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(divideLine.mas_bottom).with.offset(0);
make.left.equalTo(allBtn.mas_right).with.offset(0);
make.right.equalTo(withdrawlBtn.mas_left).with.offset(0);
make.bottom.equalTo(buyFinancialBtn.mas_top).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
[withdrawlBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(divideLine.mas_bottom).with.offset(0);
make.left.equalTo(rechargeBtn.mas_right).with.offset(0);
make.right.equalTo(view.mas_right).with.offset(0);
make.bottom.equalTo(thePrincipalAndInterestPaymentBtn.mas_top).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
[withdrawInterestPaymentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(allBtn.mas_bottom).with.offset(0);
make.left.equalTo(view.mas_left).with.offset(0);
make.right.equalTo(buyFinancialBtn.mas_left).with.offset(0);
make.bottom.equalTo(view.mas_bottom).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
[buyFinancialBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(rechargeBtn.mas_bottom).with.offset(0);
make.left.equalTo(withdrawInterestPaymentBtn.mas_right).with.offset(0);
make.right.equalTo(thePrincipalAndInterestPaymentBtn.mas_left).with.offset(0);
make.bottom.equalTo(view.mas_bottom).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
[thePrincipalAndInterestPaymentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(withdrawlBtn.mas_bottom).with.offset(0);
make.left.equalTo(buyFinancialBtn.mas_right).with.offset(0);
make.right.equalTo(view.mas_right).with.offset(0);
make.bottom.equalTo(view.mas_bottom).with.offset(0);
make.width.equalTo(allBtn.mas_width).with.offset(0);
make.height.equalTo(allBtn.mas_height).with.offset(0);
}];
相关文章推荐
- 243,mybatis 多表关联查询
- SSH框架搭建总结
- 哈希算法
- Lua重新加载Lua文件
- 3268 多项式相加
- PyQt5 笔记(02):嵌套布局
- Lua封装格式化float
- PAT 1081. Rational Sum (20)
- Java基础——hashcode()与equals()
- Lua封装格式化html
- 生活在REPL中,工具与程序一体
- Office 2016九大新功能
- javascript中面向对象思想的体现(一)
- choose the time to run your jobs--sleep
- 基于java社会化海量数据采集爬虫框架搭建
- 【MVC】——MVC框架
- python零零碎碎
- Android ScrollView滚动条
- 学习老外用webstorm开发nodejs的技巧--代码提示DefinitelyTyped
- 【设计模式】装饰器模式