DownloadStatusCell.m 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // DownloadStatusCell.m
  3. // TeacherDaya
  4. //
  5. // Created by Kyle on 2020/11/25.
  6. // Copyright © 2020 DayaMusic. All rights reserved.
  7. //
  8. #import "DownloadStatusCell.h"
  9. @interface DownloadStatusCell ()
  10. @property (weak, nonatomic) IBOutlet UIImageView *userLogo;
  11. @property (weak, nonatomic) IBOutlet UILabel *userName;
  12. @property (weak, nonatomic) IBOutlet UILabel *statusLabel;
  13. @property (nonatomic, strong) NSString *songId;
  14. @end
  15. @implementation DownloadStatusCell
  16. - (void)awakeFromNib {
  17. [super awakeFromNib];
  18. // Initialization code
  19. self.selectionStyle = UITableViewCellSelectionStyleNone;
  20. }
  21. - (void)setSourceModel:(RoomMember *)member songId:(NSString *)songId {
  22. if (!member ) {
  23. return;
  24. }
  25. self.member = member;
  26. [self.userLogo sd_setImageWithURL:[NSURL URLWithString:[member.headUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
  27. self.userName.text = [NSString returnNoNullStringWithString:member.name];
  28. NSInteger downStatus = member.downStatus;
  29. for (ClassSongMessage *message in member.songMessage) {
  30. if ([message.musicScoreAccompanimentId isEqualToString:songId]) {
  31. downStatus = message.downStatus;
  32. }
  33. }
  34. [self getStatusWithType:downStatus];
  35. }
  36. - (void)getStatusWithType:(NSInteger)statusType {
  37. if (statusType == 1) {
  38. self.statusLabel.text = @"已下载";
  39. self.statusLabel.textColor = HexRGB(0x8F8F8F);
  40. }
  41. else if (statusType == 0) {
  42. self.statusLabel.text = @"下载中";
  43. self.statusLabel.textColor = HexRGB(0x4EEBFF);
  44. }
  45. else {
  46. self.statusLabel.text = @"下载失败";
  47. self.statusLabel.textColor = HexRGB(0xff5757);
  48. }
  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