// // PBUnReadTableViewCell.m // IphoneBIMe // // Created by zjf on 2018/9/17. // Copyright © 2018年 ProBIM. All rights reserved. // #import "PBUnReadTableViewCell.h" #import "PBUnReadMesModel.h" @interface PBUnReadTableViewCell() @property (nonatomic, weak) UILabel *notifyTypeL; @property (nonatomic, weak) UILabel *timeL; @property (nonatomic, weak) UILabel *descL; @property (nonatomic, weak) UIImageView *imageV; @end @implementation PBUnReadTableViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self setupUI]; } return self; } - (void)setupUI { UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Mes_oval"]]; [self.contentView addSubview:imageV]; [imageV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView).offset(10); make.left.equalTo(self.contentView).offset(12); make.size.mas_equalTo(CGSizeMake(6, 6)); }]; UILabel *notifyTypeL = [UILabel z_labelWithText:@"问题追踪" Color:WarningColor isBold:NO Font:TitleFontSize]; [self.contentView addSubview:notifyTypeL]; [notifyTypeL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView).offset(10); make.left. equalTo(self.contentView).offset(20); make.size.mas_equalTo(CGSizeMake(200, 20)); }]; UILabel *timeL = [UILabel z_labelWithText:@"2108-09-43" Color:DescColor isBold:NO Font:DescFontSize]; timeL.textAlignment = NSTextAlignmentRight; [self.contentView addSubview:timeL]; [timeL mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(notifyTypeL); make.right.equalTo(self.contentView).offset(-16); }]; UILabel *descL = [UILabel z_labelWithText:@"xxxxxxxxxxxxxxxxxxxxxxxxxx" Color:DescColor isBold:NO Font:DescFontSize]; descL.numberOfLines = 0; [self.contentView addSubview:descL]; [descL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(notifyTypeL.mas_bottom).offset(12); make.left.equalTo(self.contentView).offset(16); make.right.equalTo(self.contentView).offset(-16); make.bottom.equalTo(self.contentView).offset(-12); }]; self.imageV = imageV; self.notifyTypeL = notifyTypeL; self.timeL = timeL; self.descL = descL; } - (void)setUnReadMesModel:(PBUnReadMesModel *)unReadMesModel { _unReadMesModel = unReadMesModel; if (unReadMesModel.LogAndMsgType == 4 || unReadMesModel.LogAndMsgType == 5 || unReadMesModel.LogAndMsgType == 6 || unReadMesModel.LogAndMsgType == 7 || unReadMesModel.LogAndMsgType == 8 || unReadMesModel.LogAndMsgType == 9 || unReadMesModel.LogAndMsgType == 10 || unReadMesModel.LogAndMsgType == 1007) { self.notifyTypeL.text = @"问题追踪"; }else if (unReadMesModel.LogAndMsgType == 21 || unReadMesModel.LogAndMsgType == 22 || unReadMesModel.LogAndMsgType == 23 || unReadMesModel.LogAndMsgType == 24 || unReadMesModel.LogAndMsgType == 25 || unReadMesModel.LogAndMsgType == 26 || unReadMesModel.LogAndMsgType == 27){ self.notifyTypeL.text = @"文档"; }else if (unReadMesModel.LogAndMsgType == 44 || unReadMesModel.LogAndMsgType == 45 || unReadMesModel.LogAndMsgType == 46){ self.notifyTypeL.text = @"现场数据"; }else if (unReadMesModel.LogAndMsgType == 47 || unReadMesModel.LogAndMsgType == 48 || unReadMesModel.LogAndMsgType == 49){ self.notifyTypeL.text = @"项目流程"; }else if (unReadMesModel.LogAndMsgType == 51){ self.notifyTypeL.text = @"项目动态"; }else { self.notifyTypeL.text = @"其它"; } self.timeL.text = [unReadMesModel.mm_createdatetimestr substringToIndex:unReadMesModel.mm_createdatetimestr.length - 3]; self.descL.text = unReadMesModel.ExtDataContent; if ([unReadMesModel.isRead isEqualToString:@"0"]) { self.imageV.hidden = NO; }else { self.imageV.hidden = YES; } } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end