XLCircleProgress.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // CircleView.m
  3. // YKL
  4. //
  5. // Created by Apple on 15/12/7.
  6. // Copyright © 2015年 Apple. All rights reserved.
  7. //
  8. #import "XLCircleProgress.h"
  9. #import "XLCircle.h"
  10. @implementation XLCircleProgress
  11. {
  12. XLCircle* _circle;
  13. }
  14. -(instancetype)initWithFrame:(CGRect)frame
  15. {
  16. self = [super initWithFrame:frame];
  17. if (self) {
  18. [self initUI];
  19. }
  20. return self;
  21. }
  22. -(void)initUI
  23. {
  24. float lineWidth = 5;
  25. _percentLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, self.size.width-10, self.size.width-10)];
  26. _percentLabel.textColor = [UIColor whiteColor];
  27. _percentLabel.textAlignment = NSTextAlignmentCenter;
  28. _percentLabel.font = [UIFont boldSystemFontOfSize:17];
  29. _percentLabel.text = @"100\n催更";
  30. _percentLabel.numberOfLines = 2;
  31. _percentLabel.backgroundColor = [UIColor whiteColor];//Pink_Cor;
  32. _percentLabel.layer.cornerRadius = (self.size.width-10.0)/2;
  33. _percentLabel.layer.masksToBounds = YES;
  34. [self addSubview:_percentLabel];
  35. _circle = [[XLCircle alloc] initWithFrame:self.bounds lineWidth:lineWidth];
  36. [self addSubview:_circle];
  37. }
  38. #pragma mark -
  39. #pragma mark Setter方法
  40. -(void)setProgress:(float)progress
  41. {
  42. _progress = progress;
  43. _circle.progress = progress;
  44. // _percentLabel.text = [NSString stringWithFormat:@"%.0f%%\n催更",progress*100];
  45. }
  46. @end