UI第十一节——UIActivityIndicatorView
- (void)viewDidLoad {
[super viewDidLoad];
// 创建一个UIActivityIndicatorView,大小是固定的
UIActivityIndicatorView *aiv = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
// 设置中心点
aiv.center = CGPointMake(200, 300);
// 颜色
aiv.color = [UIColor greenColor];
// 让UIActivityIndicatorView转起来
[aiv startAnimating];
// 5秒之后,让UIActivityIndicatorView停止动画
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[aiv stopAnimating];
});
[self.view addSubview:aiv];
self.view.backgroundColor = [UIColor grayColor];
}