// // NotifyMessageCell.m // MusicGradeExam // // Created by Kyle on 2020/7/15. // Copyright © 2020 DayaMusic. All rights reserved. // #import "NotifyMessageCell.h" @interface NotifyMessageCell () @property (weak, nonatomic) IBOutlet UIView *redDot; @property (weak, nonatomic) IBOutlet UILabel *timeLabel; @property (weak, nonatomic) IBOutlet UILabel *topMessage; @property (weak, nonatomic) IBOutlet UILabel *descMessage; @property (nonatomic, strong) MessageListModel *model; @end @implementation NotifyMessageCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code self.selectionStyle = UITableViewCellSelectionStyleNone; } - (void)configCellWithSource:(MessageListModel *)sourceModel { self.model = sourceModel; self.isRead = sourceModel.readStatus == 1 ? YES : NO; NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init]; dateFormatter.timeZone = [NSTimeZone systemTimeZone]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSDate *messageDate = [dateFormatter dateFromString:sourceModel.createOn]; [dateFormatter setDateFormat:@"MM-dd"]; NSString *dateStr = [dateFormatter stringFromDate:messageDate]; self.timeLabel.text = [NSString returnNoNullStringWithString:dateStr]; self.topMessage.text = [NSString returnNoNullStringWithString:sourceModel.title]; } - (void)setIsRead:(BOOL)isRead { _isRead = isRead; self.redDot.hidden = isRead; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end