From 781903775b62fc4bbcdfec08c2ec6a965f99e8b7 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 25 May 2015 21:59:47 -0700 Subject: [PATCH] make HUDs block the UI --- Blog/EditorViewController.m | 3 ++- Blog/PostsViewController.m | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Blog/EditorViewController.m b/Blog/EditorViewController.m index da7836b..6198eba 100644 --- a/Blog/EditorViewController.m +++ b/Blog/EditorViewController.m @@ -393,7 +393,8 @@ static NSString *const StateRestorationModifiedPostKey = @"modifiedPost"; } - (IBAction)publishOrUnpublish:(id)sender { - MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES]; + hud.dimBackground = YES; BOOL isPublish = self.modifiedPost.draft; hud.labelText = isPublish ? @"Publishing" : @"Unpublishing"; __weak typeof(self) welf = self; diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index 846356f..2bda2a5 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -305,10 +305,10 @@ static const NSUInteger SectionPublished = 1; } - (IBAction)publish:(id)sender { - // TODO: activity indicator __weak typeof(self) welf = self; void (^publish)(NSString *, PMKPromise *) = ^(NSString *message, PMKPromise *promise) { - MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES]; + hud.dimBackground = YES; hud.labelText = message; typeof(self) self = welf; promise.then(^{