ReplayMeCell.m 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. //
  2. // ReplayMeCell.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/6/11.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "ReplayMeCell.h"
  9. @implementation ReplayMeCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. self.iconV.layer.cornerRadius = 5.f;
  13. self.iconV.layer.masksToBounds = YES;
  14. self.FileImgV.layer.cornerRadius = 2.f;
  15. self.FileImgV.layer.masksToBounds = YES;
  16. self.subView.layer.cornerRadius = 5.f;
  17. self.subView.layer.masksToBounds = YES;
  18. self.subView.layer.borderColor = UIColorHex(0xE5E5E5).CGColor;
  19. self.subView.layer.borderWidth = 0.5f;
  20. self.redV.layer.cornerRadius = 5.f;
  21. self.redV.layer.masksToBounds = YES;
  22. }
  23. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  24. [super setSelected:selected animated:animated];
  25. // Configure the view for the selected state
  26. }
  27. + (ReplayMeCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  28. static NSString *cellIdentifer = @"ReplayMeCell0";
  29. ReplayMeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  30. if (cell == nil) {
  31. cell = [[[NSBundle mainBundle] loadNibNamed:@"ReplayMeCell" owner:nil options:nil] objectAtIndex:0];
  32. }
  33. return cell;
  34. }
  35. + (ReplayMeCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  36. static NSString *cellIdentifer = @"ReplayMeCell1";
  37. ReplayMeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  38. if (cell == nil) {
  39. cell = [[[NSBundle mainBundle] loadNibNamed:@"ReplayMeCell" owner:nil options:nil] objectAtIndex:1];
  40. }
  41. return cell;
  42. }
  43. - (void)setDataModel:(ReplyModel *)model
  44. {
  45. NSString * comStr = [NSString stringWithFormat:@"来自 %@",model.Remark];
  46. [self.iconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  47. self.nameL.text = model.UserName;
  48. self.timeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  49. self.contentL.text = model.CommentContent;
  50. self.subTitleL.text = model.Title;
  51. self.subComeL.attributedText = [self checkOfString:comStr withSearchText:model.Remark];
  52. switch (model.TypeValue) {
  53. case CollectModel_Aritle:
  54. {
  55. self.FileImgV.image = IMG(@"文章");
  56. }
  57. break;
  58. case CollectModel_Toipc:
  59. {
  60. self.FileImgV.image = IMG(@"话题");
  61. }
  62. break;
  63. case CollectModel_NewTopic:
  64. {
  65. self.FileImgV.image = IMG(@"话题");
  66. }
  67. break;
  68. case CollectModel_Collect:
  69. {
  70. self.FileImgV.image = IMG(@"收藏");
  71. }
  72. break;
  73. case CollectModel_NoteBook:
  74. {
  75. self.FileImgV.image = IMG(@"noteBook_icon");
  76. }
  77. break;
  78. case CollectModel_Notice:
  79. {
  80. self.FileImgV.image = IMG(@"通知图标");
  81. }
  82. break;
  83. case CollectModel_InterMail:
  84. {
  85. self.FileImgV.image = IMG(@"站内信");
  86. }
  87. break;
  88. case CollectModel_Group:
  89. {
  90. self.FileImgV.image = IMG(@"笔记小组");
  91. }
  92. break;
  93. case CollectModel_meetDetail:
  94. {
  95. self.FileImgV.image = IMG(@"会议");
  96. }
  97. break;
  98. case CollectModel_meetMian:
  99. {
  100. self.FileImgV.image = IMG(@"会议");
  101. }
  102. break;
  103. case CollectModel_CollectFile:
  104. {
  105. self.FileImgV.image = IMG(@"find_1");
  106. }
  107. break;
  108. case CollectModel_NoteFile:
  109. {
  110. self.FileImgV.image = IMG(@"find_1");
  111. }
  112. break;
  113. case CollectModel_work:
  114. {
  115. self.FileImgV.image = IMG(@"审批");
  116. }
  117. break;
  118. case CollectModel_financeCount:
  119. {
  120. self.FileImgV.image = IMG(@"报表");
  121. }
  122. break;
  123. case CollectModel_affairsCount:
  124. {
  125. self.FileImgV.image = IMG(@"报表");
  126. }
  127. break;
  128. default:
  129. {
  130. self.FileImgV.image = IMG(@"报表");
  131. }
  132. break;
  133. }
  134. }
  135. - (void)setDataCommentModel:(ReplyModel *)model
  136. {
  137. NSString * str = [NSString stringWithFormat:@"%@:%@",model.Name,model.Title];
  138. NSString * subtr = [NSString stringWithFormat:@"%@:",model.Name];
  139. NSString * comStr = [NSString stringWithFormat:@"来自 %@",model.Remark];
  140. [self.iconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  141. self.nameL.text = model.UserName;
  142. self.timeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  143. self.contentL.text = model.CommentContent;
  144. self.subTitleL.attributedText = [self checkOfString:str withSearchText:subtr];
  145. self.subComeL.attributedText = [self checkOfString:comStr withSearchText:model.Remark];
  146. }
  147. - (NSMutableAttributedString *)checkOfString:(NSString *)infoStr withSearchText:(NSString *)text
  148. {
  149. if (infoStr.length == 0) {
  150. return nil;
  151. }
  152. NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:infoStr];
  153. [attrString addAttribute:(NSString *)NSForegroundColorAttributeName
  154. value:UIColorHex(0x1F87DB)
  155. range:[infoStr rangeOfString:text]];
  156. return attrString;
  157. }
  158. @end