NewMeassageCell.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // NewMeassageCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/9/5.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. //
  8. #import "NewMeassageCell.h"
  9. @implementation NewMeassageCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. _time = [UILabel new];
  14. _time.textColor = [UIColor colorWithString:@"#AEAEAE"];
  15. _time.font = NewFont(fitScreenWidth(14));
  16. [_time setSingleLineAutoResizeWithMaxWidth:0];
  17. [self.contentView addSubview:_time];
  18. _time.sd_layout
  19. .leftSpaceToView(self.contentView, 15)
  20. .heightIs(fitScreenWidth(15))
  21. .topSpaceToView(self.contentView, 15);
  22. _neirong = [UILabel new];
  23. _neirong.lineBreakMode = NSLineBreakByTruncatingTail;
  24. _neirong.numberOfLines = 2;
  25. _neirong.font = NewFont(fitScreenWidth(16));
  26. [self.contentView addSubview:_neirong];
  27. _neirong.sd_layout
  28. .leftEqualToView(_time)
  29. .rightSpaceToView(self.contentView, 40)
  30. .maxHeightIs(fitScreenWidth(40))
  31. .topSpaceToView(_time, 20);
  32. UILabel *line = [UILabel new];
  33. line.backgroundColor = NewLineGrayColor;
  34. [self.contentView addSubview:line];
  35. line.sd_layout
  36. .bottomEqualToView(self.contentView)
  37. .heightIs(1)
  38. .widthIs(SCREEN_WIDTH);
  39. }
  40. return self;
  41. }
  42. - (void)assignment:(NewMeassageModel *)model {
  43. _time.text = [NewUtils shijian:model.createTime];
  44. _neirong.text = model.title;
  45. if ([model.isRead isEqualToString:@"1"]) {
  46. _neirong.textColor = [UIColor colorWithString:@"#3C3C3C"];
  47. }else{
  48. _neirong.textColor = NewRedColor;
  49. }
  50. }
  51. - (void)awakeFromNib {
  52. [super awakeFromNib];
  53. // Initialization code
  54. }
  55. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  56. [super setSelected:selected animated:animated];
  57. // Configure the view for the selected state
  58. }
  59. @end