| | |
| | | /// 濂栭噾 |
| | | @property (nonatomic, strong, nullable) UILabel *bonusPricelabel; |
| | | |
| | | @property (nonatomic, assign) NSInteger indexCount; |
| | | |
| | | @property (nonatomic, assign) NSInteger count; |
| | | |
| | | @end |
| | | |
| | | @implementation InviteThreeCell |
| | |
| | | |
| | | if (model) { |
| | | |
| | | for (UIView *view in [self.bgView subviews]) { |
| | | [view removeFromSuperview]; |
| | | self.indexCount = model.inviteGetMoneyList.count; |
| | | |
| | | if (self.indexCount > 5) { |
| | | |
| | | self.indexCount = 5; |
| | | } |
| | | |
| | | NSInteger indexCount = model.inviteGetMoneyList.count; |
| | | // self.count = [self.bgView subviews].count; |
| | | // |
| | | // if (self.count != 0) { |
| | | // |
| | | // for (int i = 0; i < self.indexCount; i++) { |
| | | // |
| | | // ((UIImageView *)[[self.bgView subviews][i] subviews][0]).image = [UIImage imageNamed:self.gradArr[i]]; |
| | | // |
| | | // [((UIImageView *)[[self.bgView subviews][i] subviews][1]) setYthImageWithURL:((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).portrait placeholderImage:[UIImage imageNamed:@"榛樿澶村儚"]]; |
| | | // |
| | | // ((UILabel *)[[self.bgView subviews][i] subviews][2]).text = ((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).name; |
| | | // |
| | | // ((UILabel *)[[self.bgView subviews][i] subviews][2]).text = [NSString stringWithFormat:@"楼%@",((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).money]; |
| | | // } |
| | | // |
| | | // } else { |
| | | |
| | | if (indexCount > 5) { |
| | | for (UIView *view in [self.bgView subviews]) { |
| | | [view removeFromSuperview]; |
| | | } |
| | | |
| | | indexCount = 5; |
| | | } |
| | | |
| | | for (int i = 0; i < indexCount; i++) { |
| | | |
| | | self.articleView = [[UIView alloc] init]; |
| | | self.articleView.layer.masksToBounds = YES; |
| | | self.articleView.layer.cornerRadius = 5; |
| | | self.articleView.backgroundColor = i % 2 ? SJColor(255, 211, 221, 1) : SJColor(255, 251, 207, 1); |
| | | [self.bgView addSubview:self.articleView]; |
| | | |
| | | self.articleView.sd_layout |
| | | .leftSpaceToView(self.bgView, 0) |
| | | .rightSpaceToView(self.bgView, 0) |
| | | .topSpaceToView(self.bgView, i * ((self.bgView.size.height - 32) / 5) + i * 8) |
| | | .heightIs((self.bgView.size.height - 32) / 5); |
| | | |
| | | self.logoImageView = [[UIImageView alloc] init]; |
| | | self.logoImageView.image = [UIImage imageNamed:self.gradArr[i]]; |
| | | [self.articleView addSubview:self.logoImageView]; |
| | | |
| | | self.logoImageView.sd_layout |
| | | .leftSpaceToView(self.articleView, 15) |
| | | .centerYEqualToView(self.articleView) |
| | | .widthIs(23) |
| | | .heightIs(20); |
| | | |
| | | self.headerImageView = [[UIImageView alloc] init]; |
| | | [self.headerImageView setYthImageWithURL:((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).portrait placeholderImage:[UIImage imageNamed:@"榛樿澶村儚"]]; |
| | | self.headerImageView.layer.masksToBounds = YES; |
| | | self.headerImageView.layer.cornerRadius = ((self.bgView.size.height - 32) / 5 - 10) / 2; |
| | | [self.articleView addSubview:self.headerImageView]; |
| | | |
| | | self.headerImageView.sd_layout |
| | | .leftSpaceToView(self.logoImageView, 15) |
| | | .centerYEqualToView(self.articleView) |
| | | .widthIs((self.bgView.size.height - 32) / 5 - 10) |
| | | .heightIs((self.bgView.size.height - 32) / 5 - 10); |
| | | |
| | | self.nickNamelabel = [[UILabel alloc] init]; |
| | | self.nickNamelabel.text = ((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).name; |
| | | self.nickNamelabel.textColor = [UIColor blackColor]; |
| | | self.nickNamelabel.font = [UIFont systemFontOfSize:15]; |
| | | self.nickNamelabel.textAlignment = NSTextAlignmentLeft; |
| | | [self.articleView addSubview:self.nickNamelabel]; |
| | | |
| | | self.nickNamelabel.sd_layout |
| | | .leftSpaceToView(self.headerImageView, 10) |
| | | .centerYEqualToView(self.articleView) |
| | | .heightIs(20) |
| | | .autoWidthRatio(0); |
| | | |
| | | [self.nickNamelabel setSingleLineAutoResizeWithMaxWidth:120]; |
| | | |
| | | self.bonusPricelabel = [[UILabel alloc] init]; |
| | | self.bonusPricelabel.text = [NSString stringWithFormat:@"楼%@",((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).money]; |
| | | self.bonusPricelabel.textColor = SJColor(229, 0, 92, 1.0); |
| | | self.bonusPricelabel.font = [UIFont systemFontOfSize:16]; |
| | | self.bonusPricelabel.textAlignment = NSTextAlignmentRight; |
| | | [self.articleView addSubview:self.bonusPricelabel]; |
| | | |
| | | self.bonusPricelabel.sd_layout |
| | | .rightSpaceToView(self.articleView, 10) |
| | | .centerYEqualToView(self.articleView) |
| | | .heightIs(20) |
| | | .autoWidthRatio(0); |
| | | |
| | | [self.bonusPricelabel setSingleLineAutoResizeWithMaxWidth:120]; |
| | | } |
| | | for (int i = 0; i < self.indexCount; i++) { |
| | | |
| | | self.articleView = [[UIView alloc] init]; |
| | | self.articleView.layer.masksToBounds = YES; |
| | | self.articleView.layer.cornerRadius = 5; |
| | | self.articleView.backgroundColor = i % 2 ? SJColor(255, 211, 221, 1) : SJColor(255, 251, 207, 1); |
| | | [self.bgView addSubview:self.articleView]; |
| | | |
| | | self.articleView.sd_layout |
| | | .leftSpaceToView(self.bgView, 0) |
| | | .rightSpaceToView(self.bgView, 0) |
| | | .topSpaceToView(self.bgView, i * ((self.bgView.size.height - 32) / 5) + i * 8) |
| | | .heightIs((self.bgView.size.height - 32) / 5); |
| | | |
| | | self.logoImageView = [[UIImageView alloc] init]; |
| | | self.logoImageView.image = [UIImage imageNamed:self.gradArr[i]]; |
| | | [self.articleView addSubview:self.logoImageView]; |
| | | |
| | | self.logoImageView.sd_layout |
| | | .leftSpaceToView(self.articleView, 15) |
| | | .centerYEqualToView(self.articleView) |
| | | .widthIs(23) |
| | | .heightIs(20); |
| | | |
| | | self.headerImageView = [[UIImageView alloc] init]; |
| | | [self.headerImageView setYthImageWithURL:((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).portrait placeholderImage:[UIImage imageNamed:@"榛樿澶村儚"]]; |
| | | self.headerImageView.layer.masksToBounds = YES; |
| | | self.headerImageView.layer.cornerRadius = ((self.bgView.size.height - 32) / 5 - 10) / 2; |
| | | [self.articleView addSubview:self.headerImageView]; |
| | | |
| | | self.headerImageView.sd_layout |
| | | .leftSpaceToView(self.logoImageView, 15) |
| | | .centerYEqualToView(self.articleView) |
| | | .widthIs((self.bgView.size.height - 32) / 5 - 10) |
| | | .heightIs((self.bgView.size.height - 32) / 5 - 10); |
| | | |
| | | self.nickNamelabel = [[UILabel alloc] init]; |
| | | self.nickNamelabel.text = ((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).name; |
| | | self.nickNamelabel.textColor = [UIColor blackColor]; |
| | | self.nickNamelabel.font = [UIFont systemFontOfSize:15]; |
| | | self.nickNamelabel.textAlignment = NSTextAlignmentLeft; |
| | | [self.articleView addSubview:self.nickNamelabel]; |
| | | |
| | | self.nickNamelabel.sd_layout |
| | | .leftSpaceToView(self.headerImageView, 10) |
| | | .centerYEqualToView(self.articleView) |
| | | .heightIs(20) |
| | | .autoWidthRatio(0); |
| | | |
| | | [self.nickNamelabel setSingleLineAutoResizeWithMaxWidth:120]; |
| | | |
| | | self.bonusPricelabel = [[UILabel alloc] init]; |
| | | self.bonusPricelabel.text = [NSString stringWithFormat:@"楼%@",((InviteGetMoneyListModel *)(model.inviteGetMoneyList[i])).money]; |
| | | self.bonusPricelabel.textColor = SJColor(229, 0, 92, 1.0); |
| | | self.bonusPricelabel.font = [UIFont systemFontOfSize:16]; |
| | | self.bonusPricelabel.textAlignment = NSTextAlignmentRight; |
| | | [self.articleView addSubview:self.bonusPricelabel]; |
| | | |
| | | self.bonusPricelabel.sd_layout |
| | | .rightSpaceToView(self.articleView, 10) |
| | | .centerYEqualToView(self.articleView) |
| | | .heightIs(20) |
| | | .autoWidthRatio(0); |
| | | |
| | | [self.bonusPricelabel setSingleLineAutoResizeWithMaxWidth:120]; |
| | | } |
| | | //} |
| | | } |
| | | } |
| | | |