// // KXCreditCardTableViewCell.m // CAISHEN // // Created by xiaoxi on 2017/12/1. // Copyright © 2017年 kuxuan. All rights reserved. // #import "KXCreditCardTableViewCell.h" #import "KXCreditCardModel.h" @implementation KXCreditCardTableViewCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.selectionStyle = UITableViewCellSelectionStyleNone; [self setupUI]; } return self; } - (void)setupUI { self.leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [self.leftBtn setImage:[UIImage imageNamed:@"mine_footer_normal"] forState:UIControlStateNormal]; [self.leftBtn setImage:[UIImage imageNamed:@"mine_footer_select"] forState:UIControlStateSelected]; [self.contentView addSubview:self.leftBtn]; self.iconView = [[UIImageView alloc] initWithFrame:CGRectZero]; self.iconView.backgroundColor = [UIColor whiteColor]; [self.contentView addSubview:self.iconView]; self.nameView = [[UILabel alloc] initWithFrame:CGRectZero]; self.nameView.backgroundColor = [UIColor whiteColor]; self.nameView.textColor = [UIColor titleColor]; self.nameView.font = FONT_SYS(16*SCREEN_MUTI); [self.contentView addSubview:self.nameView]; self.adView = [[UILabel alloc] initWithFrame:CGRectZero]; self.adView.backgroundColor = [UIColor whiteColor]; self.adView.textColor = [UIColor KXColorWithHex:0x666666]; self.adView.font = FONT_SYS(12*SCREEN_MUTI); [self.contentView addSubview:self.adView]; self.personsView = [[UILabel alloc] initWithFrame:CGRectZero]; self.personsView.backgroundColor = [UIColor whiteColor]; self.personsView.font = FONT_SYS(12*SCREEN_MUTI); [self.contentView addSubview:self.personsView]; self.lineView = [[UILabel alloc] initWithFrame:CGRectZero]; self.lineView.backgroundColor = [UIColor KXColorWithHex:0xf0f0f0]; [self.contentView addSubview:self.lineView]; [self setupConstraints]; } - (void)setupConstraints { [self.leftBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView.mas_left).offset(-10); make.centerY.equalTo(self.contentView.mas_centerY); }]; [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(14); make.centerY.equalTo(self.contentView); make.size.mas_equalTo(CGSizeMake(90*SCREEN_MUTI, 56*SCREEN_MUTI)); }]; [self.nameView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.iconView.mas_right).offset(10); make.top.equalTo(self.iconView.mas_top); make.right.equalTo(self.contentView); }]; [self.adView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.nameView); make.centerY.equalTo(self.contentView); make.right.equalTo(self.nameView); }]; [self.personsView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.nameView); make.bottom.equalTo(self.contentView).offset(-18*SCREEN_MUTI); make.right.equalTo(self.nameView); }]; [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(14); make.bottom.equalTo(self.contentView).offset(-0.5); make.right.equalTo(self.contentView).offset(-14); make.height.mas_equalTo(0.5); }]; } @end