MyTDGroupCell.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // MyTDGroupCell.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/10/31.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyTDGroupCell.h"
  9. @interface MyTDGroupCell()
  10. @property (nonatomic, strong) UIImageView *iconImageView;
  11. @property (nonatomic, strong) UILabel *groupNameLab;
  12. @property (nonatomic, strong) UILabel *shareNumLab;
  13. @property (nonatomic, strong) UILabel *myNewTopicLab;
  14. @property (nonatomic, strong) UILabel *countNumberLab;
  15. @property (nonatomic, strong) UIImageView *rightImage;
  16. @property (nonatomic, strong) UIView * lineView;
  17. @end
  18. @implementation MyTDGroupCell
  19. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  20. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  21. if(self){
  22. //////DRTJFHCGHVGHVGMMVG
  23. [self addSubview:self.iconImageView];
  24. [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.width.height.mas_equalTo(44);
  26. make.top.left.equalTo(self.contentView).offset(10);
  27. }];
  28. [self addSubview:self.groupNameLab];
  29. [self.groupNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.left.equalTo(self.iconImageView.mas_right).offset(10);
  31. make.top.equalTo(self.iconImageView.mas_top).offset(2);
  32. }];
  33. [self addSubview:self.shareNumLab];
  34. [self.shareNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.equalTo(self.iconImageView.mas_right).offset(10);
  36. make.top.equalTo(self.groupNameLab.mas_bottom).offset(10);
  37. }];
  38. [self addSubview:self.myNewTopicLab];
  39. [self.myNewTopicLab mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.equalTo(self.shareNumLab.mas_right).offset(23);
  41. make.top.equalTo(self.shareNumLab.mas_top).offset(0);
  42. }];
  43. [self addSubview:self.rightImage];
  44. [self.rightImage mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.top.equalTo(self.contentView).offset(17);
  46. make.left.equalTo(self.contentView).offset(kGXScreenWidth - 20);
  47. make.width.mas_equalTo(6.5);
  48. make.height.mas_equalTo(11.5);
  49. }];
  50. [self addSubview:self.countNumberLab];
  51. [self.countNumberLab mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.right.equalTo(self.rightImage.mas_left).offset(-3);
  53. make.centerY.equalTo(self.rightImage);
  54. }];
  55. [self addSubview:self.lineView];
  56. [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.left.equalTo(self).offset(65);
  58. make.bottom.equalTo(self).offset(0);
  59. make.right.equalTo(self);
  60. make.height.mas_equalTo(0.5);
  61. }];
  62. }
  63. return self;
  64. }
  65. - (void)loadGroupData:(NoticeModel *)model{
  66. [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  67. self.groupNameLab.text = model.GroupName;
  68. self.shareNumLab.text = [NSString stringWithFormat:@"共享给%ld人",model.TopicSharingCount];
  69. self.myNewTopicLab.text = [NSString stringWithFormat:@"【%ld条新话题】",model.UReadTopicCount];
  70. self.countNumberLab.text = [NSString stringWithFormat:@"%ld",model.TopicAllCount];
  71. }
  72. #pragma mark - setter
  73. - (UIImageView *)iconImageView{
  74. if (!_iconImageView) {
  75. _iconImageView = [UIImageView new];
  76. }
  77. return _iconImageView;
  78. }
  79. - (UILabel *)groupNameLab{
  80. if (!_groupNameLab) {
  81. _groupNameLab = [[UILabel alloc]init];
  82. _groupNameLab.textColor = UIColorHex(333333);
  83. _groupNameLab.font = [UIFont systemFontOfSize:15.f];
  84. }
  85. return _groupNameLab;
  86. }
  87. - (UILabel *)shareNumLab{
  88. if (!_shareNumLab) {
  89. _shareNumLab = [[UILabel alloc]init ];
  90. _shareNumLab.textColor = UIColorHex(333333);
  91. _shareNumLab.font = [UIFont systemFontOfSize:12.f];
  92. }
  93. return _shareNumLab;
  94. }
  95. - (UILabel *)myNewTopicLab{
  96. if (!_myNewTopicLab) {
  97. _myNewTopicLab = [UILabel new];
  98. _myNewTopicLab.textColor = UIColorHex(FFAE34);
  99. _myNewTopicLab.font = [UIFont systemFontOfSize:12.f];
  100. }
  101. return _myNewTopicLab;
  102. }
  103. - (UILabel *)countNumberLab{
  104. if (!_countNumberLab) {
  105. _countNumberLab = [UILabel new];
  106. _countNumberLab.textColor = UIColorHex(333333);
  107. _countNumberLab.font = [UIFont systemFontOfSize:12.f];
  108. }
  109. return _countNumberLab;
  110. }
  111. - (UIImageView *)rightImage{
  112. if (!_rightImage) {
  113. _rightImage = [UIImageView new];
  114. _rightImage.image = IMG(@"right_img");
  115. }
  116. return _rightImage;
  117. }
  118. - (UIView *)lineView{
  119. if (!_lineView) {
  120. _lineView = [[UIView alloc]init];
  121. _lineView.backgroundColor = LINEBGCOLOR;
  122. }
  123. return _lineView;
  124. }
  125. @end