开始 startAnimating
停止 stopAnimating
aiv.hidesWhenStopped=NO; 停止时仍然可见
aiv.activityIndicatorViewStyle=UIActivityIndicatorViewStyleGray; 活动指示类型中,有灰色,白色,大白色,其中大白色和其他不同以外,不知道和直接.color=[uicolor ..]有什么不同
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
self.window.backgroundColor=[UIColor whiteColor];
aiv = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(50, 50, 50, 50)];
aiv.hidesWhenStopped=NO;
//颜色和其他的不一样
aiv.color = [ UIColor grayColor];
UIButton * bu1 = [[UIButton alloc]initWithFrame:CGRectMake(50, 120, 80, 50)];
bu1.backgroundColor=[UIColor blackColor];
[bu1 setTitle:@"走一个" forState:UIControlStateNormal];
UIButton * bu2 = [[UIButton alloc]initWithFrame:CGRectMake(50, 200, 80, 50)];
bu2.backgroundColor=[UIColor blackColor];
[bu2 setTitle:@"停一停" forState:UIControlStateNormal];
//[aiv startAnimating];
// aiv.activityIndicatorViewStyle=UIActivityIndicatorViewStyleGray;
aiv.backgroundColor=[UIColor whiteColor];
[bu1 addTarget:self action:@selector(act1:) forControlEvents:UIControlEventTouchUpInside];
[bu2 addTarget:self action:@selector(act2:) forControlEvents:UIControlEventTouchUpInside];
[self.window addSubview:bu1];
[self.window addSubview:bu2];
[self.window addSubview:aiv];
[self.window makeKeyAndVisible];
return YES;
}
-(void)act1:( UIButton * )sender
{
[aiv startAnimating];
}
-(void)act2:( UIButton * )sender
{
[aiv stopAnimating];
}