-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZYAnimationTwoViewController.m
More file actions
66 lines (48 loc) · 1.72 KB
/
ZYAnimationTwoViewController.m
File metadata and controls
66 lines (48 loc) · 1.72 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// ZYAnimationTwoViewController.m
// ZYLoading_Example
//
// Created by luzhiyong on 2017/10/17.
// Copyright © 2017年 luzy. All rights reserved.
//
#import "ZYAnimationTwoViewController.h"
#import <ZYLoading/UIView+ZYLoadingView.h>
@interface ZYAnimationTwoViewController ()
@property (nonatomic, strong) UIButton *startButton;
@end
@implementation ZYAnimationTwoViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.startButton];
// 通过一张图片旋转
ZYLoadingConfigInstance.loadingType = ZYLoadingLoopImage;
ZYLoadingConfigInstance.loopImage = [UIImage imageNamed:@"loading_circle"];
ZYLoadingConfigInstance.loopImageSize = CGSizeMake(60, 60);
ZYLoadingConfigInstance.duration = 0.25f;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Actions
- (void)startAction:(id)sender {
[self.view beginLoading];
[self performSelector:@selector(stopAction:) withObject:nil afterDelay:5.f];
}
- (void)stopAction:(id)sender {
[self.view endLoading];
}
#pragma mark - Getter
- (UIButton *)startButton {
if (!_startButton) {
_startButton = [UIButton buttonWithType:UIButtonTypeCustom];
_startButton.frame = CGRectMake(20, 500, 80, 40);
[_startButton setTitle:@"开启动画" forState:UIControlStateNormal];
_startButton.backgroundColor = [UIColor blackColor];
[_startButton addTarget:self action:@selector(startAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _startButton;
}
@end