You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

98 lines
2.9 KiB

//
// 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)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