HomeSchoolContentCell.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // HomeSchoolContentCell.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/9/21.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "HomeSchoolContentCell.h"
  9. @implementation HomeSchoolContentCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  15. [super setSelected:selected animated:animated];
  16. // Configure the view for the selected state
  17. }
  18. + (HomeSchoolContentCell *)configCell:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  19. static NSString *cellIdentifer = @"HomeSchoolContentCell";
  20. HomeSchoolContentCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  21. if (cell == nil) {
  22. cell = [[[NSBundle mainBundle] loadNibNamed:@"HomeSchoolContentCell" owner:nil options:nil] objectAtIndex:0];
  23. }
  24. return cell;
  25. }
  26. - (void)setDataText:(NSString *)text
  27. {
  28. if (ISEmpty(text) || text.length == 0) {
  29. return;
  30. }
  31. NSMutableAttributedString * attr = [[NSMutableAttributedString alloc] initWithString:text];
  32. NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  33. [paragraphStyle setLineSpacing:8];
  34. [attr addAttributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSForegroundColorAttributeName:UIColorHex(0x666666),NSFontAttributeName:[UIFont systemFontOfSize:17.f]} range:NSMakeRange(0, [text length])];
  35. self.contentL.attributedText = attr;
  36. }
  37. @end