ReplayMeCell.m 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.subView.layer.cornerRadius = 5.f;
  15. self.subView.layer.masksToBounds = YES;
  16. self.subView.layer.borderColor = UIColorHex(0xE5E5E5).CGColor;
  17. self.subView.layer.borderWidth = 0.5f;
  18. self.redV.layer.cornerRadius = 5.f;
  19. self.redV.layer.masksToBounds = YES;
  20. }
  21. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  22. [super setSelected:selected animated:animated];
  23. // Configure the view for the selected state
  24. }
  25. + (ReplayMeCell *)configCell:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  26. static NSString *cellIdentifer = @"ReplayMeCell";
  27. ReplayMeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  28. if (cell == nil) {
  29. cell = [[[NSBundle mainBundle] loadNibNamed:@"ReplayMeCell" owner:nil options:nil] objectAtIndex:0];
  30. }
  31. return cell;
  32. }
  33. - (void)setDatasubText
  34. {
  35. NSString * str = @"童文洁: 这群孩子用思维导图刷新了学习力";
  36. NSString * substr = @"来自 话题";
  37. self.subTitleL.attributedText = [self checkOfString:str withSearchText:@"童文洁:"];
  38. self.subComeL.attributedText = [self checkOfString:substr withSearchText:@"话题"];
  39. }
  40. - (void)setDataWithText:(NSString *)text
  41. {
  42. NSString * str = @"数字出版行业会议的积极推动者";
  43. self.contentL.attributedText = [self checkOfString:str withSearchText:text];
  44. }
  45. - (NSMutableAttributedString *)checkOfString:(NSString *)infoStr withSearchText:(NSString *)text
  46. {
  47. if (infoStr.length == 0) {
  48. return nil;
  49. }
  50. NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:infoStr];
  51. [attrString addAttribute:(NSString *)NSForegroundColorAttributeName
  52. value:UIColorHex(0x1F87DB)
  53. range:[infoStr rangeOfString:text]];
  54. return attrString;
  55. }
  56. @end