AceSL
2020-11-21 a609d13ff3c5f4b58b286dbb9419fc9670799c99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
//  ViewController.m
//  MyCircleView
//
//  Created by 张威 on 2020/11/20.
//  Copyright © 2020 JSPY. All rights reserved.
//
 
#import "ViewController.h"
#import "MyCircleView.h"
 
@interface ViewController ()
@property (nonatomic,strong) MyCircleView *circleV;
@end
 
@implementation ViewController
 
- (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];
}
 
 
@end