11
This commit is contained in:
50
ShenQi/NotiCenterTableViewCell.m
Normal file
50
ShenQi/NotiCenterTableViewCell.m
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// NotiCenterTableViewCell.m
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import "NotiCenterTableViewCell.h"
|
||||
|
||||
#import "MacroDefine.h"
|
||||
|
||||
@implementation NotiCenterTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
|
||||
[self setSelectionStyle:(UITableViewCellSelectionStyleNone)];
|
||||
self.contentView.backgroundColor = UIColorFromRGB(0xFAFAFA);
|
||||
self.typeLabel.layer.cornerRadius = 4.f;
|
||||
self.typeLabel.layer.masksToBounds = YES;
|
||||
}
|
||||
|
||||
-(void)setList:(PushRecordList *)list
|
||||
{
|
||||
_list = list;
|
||||
|
||||
if (self.list.type == 1) {
|
||||
self.typeLabel.text = @"Text";
|
||||
self.mainView.backgroundColor = UIColorFromRGB(0xACDFEE);
|
||||
}else if (self.list.type == 2) {
|
||||
self.typeLabel.text = @"Image";
|
||||
self.mainView.backgroundColor = UIColorFromRGB(0xBDDDB7);
|
||||
}else if (self.list.type == 3) {
|
||||
self.typeLabel.text = @"Jump link";
|
||||
self.mainView.backgroundColor = UIColorFromRGB(0xC3B5D0);
|
||||
}
|
||||
UIFont *textFont = [UIFont boldSystemFontOfSize:15];
|
||||
CGFloat width = [self.typeLabel.text boundingRectWithSize:CGSizeMake(MAXFLOAT, 30) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: textFont} context:nil].size.width;
|
||||
self.widthConstraint.constant = width+20;
|
||||
self.dateLabel.text = self.list.createTime;
|
||||
self.titleLabel.text = self.list.title;
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user