RecordTipsView.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // RecordTipsView.m
  3. // MusicGradeExam
  4. //
  5. // Created by Kyle on 2020/7/22.
  6. // Copyright © 2020 DayaMusic. All rights reserved.
  7. //
  8. #import "RecordTipsView.h"
  9. @interface RecordTipsView ()
  10. @property (weak, nonatomic) IBOutlet UILabel *tipsLabel;
  11. @end
  12. @implementation RecordTipsView
  13. + (instancetype)shareInstance {
  14. RecordTipsView *view = [[[NSBundle mainBundle] loadNibNamed:@"RecordTipsView" owner:nil options:nil] firstObject];
  15. return view;
  16. }
  17. - (void)configWithEndTime:(NSString *)endTime {
  18. if (![NSString isEmptyString:endTime]) {
  19. NSString *messageStr = [NSString stringWithFormat:@"请于%@前依次完成考级曲目的提交,规定时间后,未提交完成,则视为缺考。", endTime];
  20. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  21. [paragraphStyle setLineSpacing:4];//调整行间距
  22. NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:messageStr attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:14.0f weight:UIFontWeightMedium],NSForegroundColorAttributeName:HexRGB(0x808080)}];
  23. [attrStr addAttributes:@{NSForegroundColorAttributeName:HexRGB(0xff5c00)} range:NSMakeRange(2, endTime.length)];
  24. self.tipsLabel.attributedText = attrStr;
  25. }
  26. else {
  27. self.tipsLabel.text = @"";
  28. }
  29. }
  30. /*
  31. // Only override drawRect: if you perform custom drawing.
  32. // An empty implementation adversely affects performance during animation.
  33. - (void)drawRect:(CGRect)rect {
  34. // Drawing code
  35. }
  36. */
  37. @end