SystemmessageCell.m 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // SystemmessageCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/9.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "SystemmessageCell.h"
  9. @implementation SystemmessageCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. _image = [UIImageView new];
  14. [self.contentView addSubview:_image];
  15. _image.sd_layout
  16. .leftSpaceToView(self.contentView, 15)
  17. .topSpaceToView(self.contentView, 10)
  18. .heightIs(fitScreenWidth(18))
  19. .widthIs(fitScreenWidth(18));
  20. _time = [UILabel new];
  21. _time.textColor = [UIColor colorWithString:@"#9A9A9A"];
  22. _time.font = NewFont(fitScreenWidth(11));
  23. [_time setSingleLineAutoResizeWithMaxWidth:0];
  24. [self.contentView addSubview:_time];
  25. _time.sd_layout
  26. .leftSpaceToView(_image, fitScreenWidth(11))
  27. .centerYEqualToView(_image)
  28. .heightIs(10);
  29. _message = [UILabel new];
  30. _message.textColor = [UIColor colorWithString:@"#3C3C3C"];
  31. _message.font = NewFont(fitScreenWidth(13));
  32. _message.numberOfLines = 1;
  33. _message.lineBreakMode = NSLineBreakByTruncatingTail;
  34. [self.contentView addSubview:_message];
  35. _message.sd_layout
  36. .leftSpaceToView(self.contentView, 15)
  37. .rightSpaceToView(self.contentView, 15)
  38. .heightIs(12)
  39. .topSpaceToView(self.contentView, fitScreenWidth(38));
  40. _line = [UILabel new];
  41. _line.backgroundColor = NewLineGrayColor;
  42. [self.contentView addSubview:_line];
  43. _line.sd_layout
  44. .leftSpaceToView(self.contentView, 15)
  45. .rightSpaceToView(self.contentView, 15)
  46. .bottomEqualToView(self.contentView)
  47. .heightIs(0.8);
  48. }
  49. return self;
  50. }
  51. - (void)assignment:(SystemModel *)model {
  52. _time.text = [NSString stringWithFormat:@"提示 %@",model.createTime];
  53. _message.text = model.body;
  54. if ([model.isRead isEqualToString:@"0"]) {
  55. [_image setImage:[UIImage imageNamed:@"xiwd"]];
  56. }else{
  57. [_image setImage:[UIImage imageNamed:@"xiyd"]];
  58. }
  59. }
  60. - (void)awakeFromNib {
  61. [super awakeFromNib];
  62. // Initialization code
  63. }
  64. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  65. [super setSelected:selected animated:animated];
  66. // Configure the view for the selected state
  67. }
  68. @end