YBUploadProgress.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // YBUploadProgress.m
  3. // TestApp
  4. //
  5. // Created by YB007 on 2020/7/7.
  6. // Copyright © 2020 Rookie. All rights reserved.
  7. //
  8. #import "YBUploadProgress.h"
  9. #import "RKCircularProgress.h"
  10. @interface YBUploadProgress()
  11. @property(nonatomic,strong)UIImageView *bgIV;
  12. @property(nonatomic,strong)RKCircularProgress *cirularPro;
  13. @end
  14. @implementation YBUploadProgress
  15. - (id)initWithFrame:(CGRect)frame {
  16. if (self = [super initWithFrame:frame]) {
  17. self.backgroundColor = [UIColor whiteColor];
  18. self.layer.cornerRadius = 5;
  19. self.clipsToBounds = YES;
  20. [self addSubview:self.bgIV];
  21. [self addSubview:self.cirularPro];
  22. }
  23. return self;
  24. }
  25. - (UIImageView *)bgIV {
  26. if (!_bgIV) {
  27. _bgIV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
  28. _bgIV.contentMode = UIViewContentModeScaleAspectFill;
  29. _bgIV.clipsToBounds = YES;
  30. }
  31. return _bgIV;
  32. }
  33. - (RKCircularProgress *)cirularPro {
  34. if (!_cirularPro) {
  35. _cirularPro = [[RKCircularProgress alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
  36. }
  37. return _cirularPro;;
  38. }
  39. //
  40. -(void)setProImg:(UIImage *)proImg{
  41. _proImg = proImg;
  42. if (_proImg) {
  43. _bgIV.image = _proImg;
  44. }
  45. }
  46. - (void)setProgress:(CGFloat)progress {
  47. _progress = progress;
  48. _cirularPro.progress = _progress;
  49. }
  50. @end