// // ChooseContactTableViewCell.m // LekangGuard // // Created by ecell on 2022/11/29. // #import "ChooseContactTableViewCell.h" #import "PPGetAddressBook.h" @interface ChooseContactTableViewCell () @property (nonatomic ,weak) UIImageView *selectImg; /// 姓名 @property (nonatomic ,weak) UILabel *nameLabel; /// 手机号 @property (nonatomic ,weak) UILabel *phoneLabel; @end @implementation ChooseContactTableViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.selectionStyle = UITableViewCellSelectionStyleNone; //self.backgroundColor = KKClearColor; [self subCellView]; } return self; } - (void)setPerModel:(PPPersonModel *)perModel { self.nameLabel.text = perModel.name; if(perModel.mobileArray.count > 1) { self.phoneLabel.text = [NSString stringWithFormat:@"%@(%zd)",perModel.mobileArray[0],perModel.mobileArray.count]; } else if (perModel.mobileArray.count > 0) { self.phoneLabel.text = perModel.mobileArray[0]; } else { self.phoneLabel.text = GJText(@"未知"); } self.selectImg.image = perModel.isSelect ? ImageName_(@"icon_selectImg_Yes") : ImageName_(@"icon_selectImg_No"); } - (void)setIsAddFamily:(BOOL)isAddFamily { _isAddFamily = isAddFamily; self.selectImg.hidden = isAddFamily; [self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) { if (isAddFamily) make.left.equalTo(self.contentView).offset(15); else make.left.equalTo(self.selectImg.mas_right).offset(10); make.centerY.equalTo(self.contentView); }]; } - (void)subCellView { UIImageView *selectImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_selectImg_No"]; self.selectImg = selectImg; [self.contentView addSubview:selectImg]; [selectImg mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(15); make.centerY.equalTo(self.contentView); make.size.mas_equalTo(CGSizeMake(Adapted(selectImg.image.size.width), Adapted(selectImg.image.size.height))); }]; UILabel *nameLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(15) textColor:KKTextBlackColor text:@"" Radius:0]; self.nameLabel = nameLabel; [self.contentView addSubview:nameLabel]; [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(selectImg.mas_right).offset(10); make.centerY.equalTo(self.contentView); }]; 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.mas_right).offset(10); make.centerY.equalTo(self.contentView); }]; } - (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