UIActivityIndicatorViewStyle activityIndicatorViewStyle;//风格设置
1.UIActivityIndicatorViewStyleWhiteLarge
2.UIActivityIndicatorViewStyleWhite
3.UIActivityIndicatorViewStyleWhite
BOOL hidesWhenStopped;//停止时隐藏视图,默认是YES
UIColor *color;//修改指示器的颜色,注意版本问题
#import "ViewController.h"
@interface ViewController ()
@property(strong,nonatomic)UIActivityIndicatorView *activity;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_activity = [[UIActivityIndicatorView alloc] initWithFrame:
CGRectMake(0, 0, 40, 40)];//指定进度轮的大小
_activity.center = CGPointMake(160, 140);//指定进度轮的中心点
//设置进度轮的显示类型
[_activity setActivityIndicatorViewStyle:
UIActivityIndicatorViewStyleGray];
[self.view addSubview:_activity];
}
- (IBAction)activityButton:(id)sender {
-
if ([_activity isAnimating]) {
[_activity stopAnimating];
NSLog(@"进度结束");
}else{
[_activity startAnimating];
NSLog(@"进度开始");
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/wow09_1225/article/details/46757729