旋转轮子
*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];
}
时间: 2024-10-10 20:54:32