// // FamilyNumberTableViewCell.m // LekangGuard // // Created by ecell on 2022/12/6. // #import "FamilyNumberTableViewCell.h" @interface FamilyNumberTableViewCell () @property (nonatomic ,weak) UIImageView *iconImg; @property (nonatomic ,weak) UILabel *typeLabel; /// 姓名 @property (nonatomic ,weak) UILabel *nameLabel; /// 手机号 @property (nonatomic ,weak) UILabel *phoneLabel; @end @implementation FamilyNumberTableViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.selectionStyle = UITableViewCellSelectionStyleNone; self.backgroundColor = KKWhiteColorColor; [self subCellView]; } return self; } - (void)setModels:(FamilyModel *)models { _models = models; self.nameLabel.text = models.name; self.phoneLabel.text = models.phone; self.typeLabel.text = F(@"快捷键:%@", models.number); } - (void)subCellView { UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_home_phone_book"]; self.iconImg = iconImg; [self.contentView addSubview:iconImg]; [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(15); make.centerY.equalTo(self.contentView); make.size.mas_equalTo(CGSizeMake(Adapted(45), Adapted(45))); }]; UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(13) textColor:KKTextBlackColor text:@"" Radius:0]; self.nameLabel = nameLabel; [self.contentView addSubview:nameLabel]; [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(iconImg.mas_right).offset(10); make.top.equalTo(iconImg); }]; UILabel *phoneLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(13) textColor:KKGrey102 text:@"" Radius:0]; self.phoneLabel = phoneLabel; [self.contentView addSubview:phoneLabel]; [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(nameLabel); make.centerY.equalTo(self.contentView); }]; UILabel *typeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(13) textColor:UIColor.greenColor text:@"" Radius:0]; self.typeLabel = typeLabel; [self.contentView addSubview:typeLabel]; [typeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(nameLabel); make.bottom.equalTo(self.contentView.mas_bottom).inset(10); }]; UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; [self.contentView addSubview:rightImg]; [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView.mas_right).inset(15); make.centerY.equalTo(self.contentView); make.size.mas_equalTo(rightImg.image.size); }]; } - (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 } @end