AceSL
2020-11-21 a609d13ff3c5f4b58b286dbb9419fc9670799c99
MyCircleView/ViewController.m
@@ -7,9 +7,10 @@
//
#import "ViewController.h"
#import "MyCircleView.h"
@interface ViewController ()
@property (nonatomic,strong) MyCircleView *circleV;
@end
@implementation ViewController
@@ -17,6 +18,25 @@
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithRed:41/255.0 green:133/255.0 blue:266/255.0 alpha:1.0];
    _circleV = [[MyCircleView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
    [self.view addSubview:_circleV];
    [_circleV circleWithProgress:90 value:128 * 0.9];
    UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(100, 400, 100, 44);
    [button setTitle:@"刷新" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(refreshAnimation) forControlEvents:UIControlEventTouchUpInside];
}
- (void)refreshAnimation
{
    NSInteger progress = arc4random_uniform(100);
    [_circleV circleWithProgress:progress value:128 * progress/100.0];
}