//
|
// 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
|