2010-07-19 53 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;