Recommended Way:
#import "MBProgressHUD.h"
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
// do something...
Service *service = [Service instance];
[service resizeDownLoadImage];
dispatch_async(dispatch_get_main_queue(), ^{
// update main UI
[hud removeFromSuperview];
//UITableView/UICollectionView reloadData is synchronous call
//[self.collectionview reloadData];
[self presentMainViewController];
});
});
Show Text Only:
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
hud.mode = MBProgressHUDModeText;
hud.labelText = msg;
hud.margin = 10.f;
hud.yOffset = self.view.frame.size.height*0.5 - 15.f;
hud.removeFromSuperViewOnHide = YES;
// auto hide after 1 second
[hud hide:YES afterDelay:1];