MessagecurrencyCell.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //
  2. // MessagecurrencyCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/18.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "MessagecurrencyCell.h"
  9. @implementation MessagecurrencyCell
  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. ViewRadius(_image, fitScreenWidth(44)/2);
  16. _image.sd_layout
  17. .leftSpaceToView(self.contentView, 10)
  18. .heightIs(fitScreenWidth(44))
  19. .widthIs(fitScreenWidth(44))
  20. .centerYEqualToView(self.contentView);
  21. _title = [UILabel new];
  22. _title.font = NewFont(fitScreenWidth(15));
  23. _title.textColor = NewBlackColor;
  24. [_title setSingleLineAutoResizeWithMaxWidth:0];
  25. [self.contentView addSubview:_title];
  26. _title.sd_layout
  27. .leftSpaceToView(_image, 8)
  28. .heightIs(14)
  29. .topSpaceToView(self.contentView, 15);
  30. _content = [UILabel new];
  31. _content.font = NewFont(fitScreenWidth(12));
  32. _content.textColor = [UIColor colorWithString:@"#9A9A9A"];
  33. _content.numberOfLines = 1;
  34. _content.lineBreakMode = NSLineBreakByTruncatingTail;
  35. _content.textAlignment = NSTextAlignmentLeft;
  36. [self.contentView addSubview:_content];
  37. _content.sd_layout
  38. .leftEqualToView(_title)
  39. .heightIs(12)
  40. .rightSpaceToView(self.contentView, 35)
  41. .bottomSpaceToView(self.contentView, 13);
  42. _time = [UILabel new];
  43. _time.font = NewFont(fitScreenWidth(10));
  44. _time.textColor = [UIColor colorWithString:@"#9A9A9A"];
  45. [_time setSingleLineAutoResizeWithMaxWidth:0];
  46. [self.contentView addSubview:_time];
  47. _time.sd_layout
  48. .topSpaceToView(self.contentView, 18)
  49. .heightIs(10)
  50. .rightSpaceToView(self.contentView, 15);
  51. _corner = [UILabel new];
  52. _corner.textColor = NewWhiteColor;
  53. _corner.font = NewFont(10);
  54. ViewRadius(_corner, 15/2);
  55. _corner.textAlignment = NSTextAlignmentCenter;
  56. [self.contentView addSubview:_corner];
  57. _corner.sd_layout
  58. .widthIs(15)
  59. .heightIs(15)
  60. .rightSpaceToView(self.contentView, 15)
  61. .bottomSpaceToView(self.contentView, 15);
  62. UILabel *line = [UILabel new];
  63. line.backgroundColor = NewLineGrayColor;
  64. [self.contentView addSubview:line];
  65. line.sd_layout
  66. .leftEqualToView(self.contentView)
  67. .rightEqualToView(self.contentView)
  68. .heightIs(0.8)
  69. .bottomEqualToView(self.contentView);
  70. /*
  71. */
  72. }
  73. return self;
  74. }
  75. - (void)assignment:(TaoXinModel *)model {
  76. [_image setImage:[UIImage imageNamed:@"系统消息"]];
  77. [_title setText:model.sysMessageTitle];
  78. _time.text = model.sysMessageDate;
  79. if ([model.sysMessageUnRead integerValue] >99) {
  80. _corner.text = @"N+";
  81. }else{
  82. _corner.text = model.sysMessageUnRead;
  83. }
  84. }
  85. - (void)awakeFromNib {
  86. [super awakeFromNib];
  87. // Initialization code
  88. }
  89. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  90. [super setSelected:selected animated:animated];
  91. // Configure the view for the selected state
  92. }
  93. @end