2010-07-19 52 views

回答

6
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; 

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; 

会做的伎俩!

编辑:发现这是在旧的项目,客户要求有更好的能见度的指标:

-(void)invokeMegaAnnoyingPopup 
{ 
    self.megaAlert = [[[UIAlertView alloc] initWithTitle:@"Please wait..." 
     message:nil delegate:self cancelButtonTitle:nil 
     otherButtonTitles: nil] autorelease]; 

    [self.megaAlert show]; 

    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] 
     initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; 

    indicator.center = CGPointMake(self.megaAlert.bounds.size.width/2, 
            self.megaAlert.bounds.size.height - 45); 
    [indicator startAnimating]; 
    [self.megaAlert addSubview:indicator]; 
    [indicator release]; 
} 

-(void)dismissMegaAnnoyingPopup 
{ 
    [self.megaAlert dismissWithClickedButtonIndex:0 animated:YES]; 
    self.megaAlert = nil; 
} 

当然,你需要在你的类中定义的UIAlertView *megaAlert;