旋转* UIActivityIndicatorView

时间:2022-03-25 00:15:30

旋转*

*activityView = [[UIActivityIndicatorView alloc ]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];

activityView.center= CGPointMake(160, 200);

[activityView startAnimating];

[activityView hidesWhenStopped];

[self.window addSubview:activityView];

[activityView release];

[NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(test:) userInfo:activityView repeats:NO];

[[UIApplication sharedApplication ]setNetworkActivityIndicatorVisible:YES];//显示在状态栏

return YES;

}

-(void) test:(NSTimer *)timer

{     [[UIApplication sharedApplication ]setNetworkActivityIndicatorVisible:NO];

UIActivityIndicatorView *activityView =[timer userInfo];

[activityView stopAnimating];

}