Create a gist now

Instantly share code, notes, and snippets.

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