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.
126 lines
3.8 KiB
126 lines
3.8 KiB
// |
|
// MyTableViewCell.m |
|
// tongxin |
|
// |
|
// Created by ecell on 2023/6/21. |
|
// Copyright © 2023 xTT. All rights reserved. |
|
// |
|
|
|
#import "MyTableViewCell.h" |
|
#import "DPClearCacheTool.h" |
|
|
|
@interface MyTableViewCell () |
|
|
|
@property (nonatomic ,weak) UIImageView *iconImg; |
|
|
|
@property (nonatomic ,weak) UILabel *titleLabel; |
|
|
|
/// 未读消息展示红点 |
|
@property (nonatomic ,weak) UILabel *newsMeg; |
|
|
|
///缓存显示 |
|
@property (nonatomic ,weak) UILabel *cacheLabel; |
|
|
|
@end |
|
|
|
@implementation MyTableViewCell |
|
|
|
- (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)setImageName:(NSString *)imageName |
|
{ |
|
_imageName = imageName; |
|
self.iconImg.image = ImageName_(imageName); |
|
} |
|
|
|
- (void)setTitleName:(NSString *)titleName |
|
{ |
|
_titleName = titleName; |
|
self.titleLabel.text = titleName; |
|
if ([titleName isEqualToString:@"清除缓存"]) |
|
self.cacheLabel.text = [DPClearCacheTool getCacheSize]; |
|
self.cacheLabel.hidden = [titleName isEqualToString:@"清除缓存"] ? NO : YES; |
|
} |
|
|
|
- (void)setMessageCount:(NSNumber *)messageCount |
|
{ |
|
_messageCount = messageCount; |
|
} |
|
|
|
- (void)subCellView |
|
{ |
|
|
|
|
|
UIImageView *iconImg = [UIImageView new]; |
|
self.iconImg = iconImg; |
|
[self.contentView addSubview:iconImg]; |
|
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.left.equalTo(self.contentView).offset(25); |
|
make.centerY.equalTo(self.contentView); |
|
make.size.mas_equalTo(CGSizeMake(22, 22)); |
|
}]; |
|
|
|
UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(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(19); |
|
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.right.equalTo(self.contentView.mas_right).inset(29); |
|
make.centerY.equalTo(self.contentView); |
|
make.size.mas_equalTo(rightImg.image.size); |
|
}]; |
|
|
|
/// 未读消息展示红点 |
|
UILabel *newsMeg = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKGrey121 text:@"" Radius:5]; |
|
newsMeg.backgroundColor = UIColor.redColor; |
|
newsMeg.hidden = YES; |
|
self.newsMeg = newsMeg; |
|
[self.contentView addSubview:newsMeg]; |
|
[newsMeg mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.right.equalTo(rightImg.mas_left).inset(15); |
|
make.centerY.equalTo(self.contentView); |
|
make.width.height.mas_equalTo(10); |
|
}]; |
|
|
|
///缓存显示 |
|
UILabel *cacheLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontADA_(12) textColor:KKGrey121 text:[DPClearCacheTool getCacheSize] Radius:0]; |
|
cacheLabel.hidden = YES; |
|
self.cacheLabel = cacheLabel; |
|
[self.contentView addSubview:cacheLabel]; |
|
[cacheLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
|
make.right.equalTo(rightImg.mas_left).inset(15); |
|
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
|
|
|