@interface UIProgressHUD : NSObject - (void) show: (BOOL) yesOrNo; - (UIProgressHUD *) initWithWindow: (UIView *) window; @end @interface HelloController : UIViewController @end @implementation HelloController - (void) killHUD: (id) aHUD { [aHUD show:NO]; [aHUD release]; } - (void) presentSheet { id HUD = [[UIProgressHUD alloc] initWithWindow:self.view]; [HUD setText:@"Downloading File. Please wait."]; [HUD show:YES]; [self performSelector:@selector(killHUD:) withObject:HUD afterDelay:5.0]; }
调用 presentSheet