Skip to content

Instantly share code, notes, and snippets.

@rizumita
Created May 20, 2011 03:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rizumita/982300 to your computer and use it in GitHub Desktop.
Save rizumita/982300 to your computer and use it in GitHub Desktop.
MBProgressHUD with Blocks
#if NS_BLOCKS_AVAILABLE
- (void)showWhileExecutingBlock:(void (^)())block animated:(BOOL)animated {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
block();
dispatch_async(dispatch_get_main_queue(), ^(void) {
[self cleanUp];
});
});
[self show:animated];
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment