readme
1 #import "ViewController.h"
2 #import "SVProgressHUD.h"
3
4 @interface ViewController ()
5 - (IBAction)seitchClick:(UISwitch *)sender;
6
7 @end
8
9 @implementation ViewController
10
11 - (void)viewDidLoad {
12 [super viewDidLoad];
13
14 self.view.backgroundColor = [UIColor orangeColor];
15
16
17 }
18
19 - (void)didReceiveMemoryWarning {
20 [super didReceiveMemoryWarning];
21 // Dispose of any resources that can be recreated.
22 }
23
24 - (IBAction)seitchClick:(UISwitch *)sender {
25
26 NSLog(@"%d",sender.isOn);
27
28 if (sender.isOn) {
29 [self gogo];
30 }else{
31 [self dismissHUD];
32 }
33
34 }
35
36 - (void)gogo{
37
38 // [SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeNone];
39
40 // 设置字体大小
41 // [SVProgressHUD setFont:[UIFont systemFontOfSize:17.0]];
42
43 // 显示成功信息
44 // [SVProgressHUD showSuccessWithStatus:@"hahhaha成功"];
45
46 // [SVProgressHUD showErrorWithStatus:@"失败sadfja"];
47
48 // [SVProgressHUD showProgress:.5f];
49
50 // [SVProgressHUD showProgress:.5f status:@"请稍等..."];
51
52
53 [SVProgressHUD showWithStatus:@"hahhah哈hahhah哈哈hahhah哈哈hahhah哈哈hahhah哈哈哈哈😄"];
54
55 // 添加朦板,不可操作,其它控件
56 // [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
57 // [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeGradient];
58
59 // 黑色背景,可用于,夜间模式
60 // [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
61
62 // 设置动画效果,没看出 有什么区别
63 // [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
64
65
66 // NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(dismissHUD) userInfo:nil repeats:NO];
67
68
69 // 设置为SVProgressHUDStyleCustom,背景颜色,和前景颜色才有效
70 // [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
71
72 // [SVProgressHUD setBackgroundColor:[UIColor clearColor]];
73
74 // [SVProgressHUD showImage:[UIImage imageNamed:@"king32"] status:@"haha哈哈"];
75
76
77 // [SVProgressHUD showInfoWithStatus:@"hahhasdfjksdjf;asdjfka"];
78
79 // [SVProgressHUD setStatus:@"hahhah哈哈哈哈哈哈"];
80 // [SVProgressHUD show];
81 }
82
83 - (void)dismissHUD{
84
85 NSLog(@"%s",__func__);
86
87 [SVProgressHUD dismiss];
88 }
89
90 @end