UploadCell.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // UploadCell.m
  3. // RA Image
  4. //
  5. // Created by Jack on 2017/5/5.
  6. // Copyright © 2017年 USAI. All rights reserved.
  7. //
  8. #import "UploadCell.h"
  9. #import "const.h"
  10. @interface UploadCell ()
  11. @property (strong, nonatomic) IBOutlet UILabel *nameLabel;
  12. @property (strong, nonatomic) IBOutlet UIProgressView *progressView;
  13. @property (strong, nonatomic) IBOutlet UILabel *progressIndicator;
  14. @property (strong, nonatomic) IBOutlet UILabel *errorLabel;
  15. @property (strong, nonatomic) IBOutlet UILabel *stateLabel;
  16. @end
  17. @implementation UploadCell
  18. - (void)awakeFromNib {
  19. [super awakeFromNib];
  20. // Initialization code
  21. }
  22. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  23. [super setSelected:selected animated:animated];
  24. // Configure the view for the selected state
  25. }
  26. - (void)setName:(NSString *)name {
  27. _name = name;
  28. self.nameLabel.text = name;
  29. }
  30. - (void)setProgress:(float)progress {
  31. // DebugLog(@"cell %p setProgress %f",self,progress);
  32. if (progress < 0) {
  33. progress = 0.0f;
  34. }
  35. if (progress > 1) {
  36. progress = 1.0f;
  37. }
  38. _progress = progress;
  39. self.progressView.progress = progress;
  40. progress = progress * 100;
  41. self.progressIndicator.text = [NSString stringWithFormat:@"%.1f%%",progress];
  42. }
  43. - (void)setState:(NSString *)state {
  44. _state = state;
  45. self.stateLabel.text = state;
  46. }
  47. - (void)setErrorMsg:(NSString *)errorMsg {
  48. _errorMsg = errorMsg;
  49. if (errorMsg.length) {
  50. self.errorLabel.hidden = NO;
  51. self.errorLabel.text = errorMsg;
  52. } else {
  53. self.errorLabel.hidden = YES;
  54. self.errorLabel.text = nil;
  55. }
  56. }
  57. @end