Skip to content

Instantly share code, notes, and snippets.

@matej
Created August 24, 2012 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matej/51201edcc84853e88c7c to your computer and use it in GitHub Desktop.
Save matej/51201edcc84853e88c7c to your computer and use it in GitHub Desktop.
MBProgressHUD static
static MBProgressHUD *__hud = nil;
+ (MBProgressHUD *)showGlobalProgressHUDWithTitle:(NSString *)title {
UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];
if (!__hud) {
__hud = [[MBProgressHUD alloc] initWithView:window];
}
__hud.labelText = title;
[window addSubview:__hud];
[__hud show:animated];
return hud;
}
+ (void)dismissGlobalHUD {
hud.removeFromSuperViewOnHide = YES;
[hud hide:animated];
[MBProgressHUD hideHUDForView:window animated:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment