// // MyTableViewCollectionCell.m // tongxin // // Created by ecell on 2023/4/27. // Copyright © 2023 xTT. All rights reserved. // #import "MyTableViewCollectionCell.h" #import "DPClearCacheTool.h" @interface MyTableViewCollectionCell () @property (nonatomic ,weak) UILabel *msgLabel; @property (nonatomic ,weak) UIImageView *iconImg; @end @implementation MyTableViewCollectionCell - (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)setImageStr:(NSString *)imageStr { _imageStr = imageStr; self.iconImg.image = ImageName_(imageStr); } - (void)setTitleStr:(NSString *)titleStr { _titleStr = titleStr; self.titleLabel.text = titleStr; self.msgLabel.text = [titleStr isEqualToString:@"清除缓存"] ? [DPClearCacheTool getCacheSize] : @""; } - (void)subCellView { UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@""]; self.iconImg = iconImg; [self.contentView addSubview:iconImg]; [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.contentView); make.left.equalTo(self.contentView).offset(15); make.size.mas_equalTo(CGSizeMake(20, 20)); }]; UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(16) textColor:KKTextBlackColor text:@"" Radius:0]; self.titleLabel = titleLabel; [self.contentView addSubview:titleLabel]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(iconImg.mas_right).offset(10); make.centerY.equalTo(self.contentView); }]; /// 右箭头 UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; [self.contentView addSubview:rightImg]; [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.contentView); make.right.equalTo(self.contentView.mas_right).inset(15); make.size.mas_equalTo(rightImg.image.size); }]; UILabel *msgLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:Font_(14) textColor:KKGrey102 text:@"" Radius:0]; self.msgLabel = msgLabel; [self.contentView addSubview:msgLabel]; [msgLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(rightImg.mas_left).inset(5); 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