AccompanyEvaluateCell.m 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // AccompanyEvaluateCell.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by 王智 on 2022/4/6.
  6. //
  7. #import "AccompanyEvaluateCell.h"
  8. @interface AccompanyEvaluateCell ()
  9. @property (weak, nonatomic) IBOutlet UILabel *tipsMsg;
  10. @property (weak, nonatomic) IBOutlet UIView *emptyView;
  11. @property (weak, nonatomic) IBOutlet UILabel *contentLabel;
  12. @end
  13. @implementation AccompanyEvaluateCell
  14. - (void)awakeFromNib {
  15. [super awakeFromNib];
  16. // Initialization code
  17. self.selectionStyle = UITableViewCellSelectionStyleNone;
  18. }
  19. - (void)configWithEvaluateMessage:(NSString *)evaluateMessage courseStatus:(NSString *)courseStatus hasEvaluate:(BOOL)hasEvaluate {
  20. NSString *tipsDesc = @"";
  21. if ([courseStatus isEqualToString:@"COMPLETE"]) {
  22. tipsDesc = @"老师尚未评价";
  23. if (hasEvaluate) {
  24. self.emptyView.hidden = YES;
  25. if (![NSString isEmptyString:evaluateMessage]) {
  26. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  27. [paragraphStyle setLineSpacing:4];//调整行间距
  28. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:evaluateMessage attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x333333)}];
  29. self.contentLabel.attributedText = attr;
  30. }
  31. else {
  32. self.contentLabel.attributedText = nil;
  33. }
  34. }
  35. else {
  36. self.emptyView.hidden = NO;
  37. self.contentLabel.attributedText = nil;
  38. }
  39. }
  40. else {
  41. tipsDesc = @"课程结束之后老师才能对您的学习进行评价哦";
  42. self.emptyView.hidden = NO;
  43. self.contentLabel.attributedText = nil;
  44. }
  45. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  46. [paragraphStyle setLineSpacing:4];//调整行间距
  47. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:tipsDesc attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x999999)}];
  48. self.tipsMsg.attributedText = attr;
  49. }
  50. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  51. [super setSelected:selected animated:animated];
  52. // Configure the view for the selected state
  53. }
  54. @end