// // TabMessageTableViewCell.m // LekangGuard // // Created by ecell on 2023/6/7. // #import "TabMessageTableViewCell.h" @interface TabMessageTableViewCell () @property (nonatomic ,weak) UIImageView *iconImg; @property (nonatomic ,weak) UILabel *titleLabel; @end @implementation TabMessageTableViewCell - (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)setTitleStr:(NSString *)titleStr { _titleStr = titleStr; self.titleLabel.text = titleStr; } - (void)setImageStr:(NSString *)imageStr { _imageStr = imageStr; self.iconImg.image = ImageName_(imageStr); } - (void)subCellView { UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor]; [self.contentView addSubview:bgView]; [bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.contentView).inset(15); make.top.equalTo(self.contentView).offset(15); make.bottom.equalTo(self.contentView.mas_bottom); }]; UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@""]; self.iconImg = iconImg; [bgView addSubview:iconImg]; [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(bgView).offset(15); make.centerY.equalTo(bgView); make.size.mas_equalTo(CGSizeMake(40, 40)); }]; UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(15) textColor:KKTextBlackColor text:@"" Radius:0]; self.titleLabel = titleLabel; [bgView addSubview:titleLabel]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(iconImg.mas_right).offset(10); make.centerY.equalTo(bgView); }]; } - (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