// You can add hud on main thread as
// HUD = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
dispatch_queue_t workerQueue = dispatch_queue_create("QueueIdentifier", NULL);
dispatch_async(workerQueue, ^ {
// do something for network or any thing which is not using UI changes
dispatch_sync(dispatch_get_main_queue(), ^{
// change in UI run this code
// like hide HUD
// [HUD removeFromSuperview];
});
});
// HUD = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
dispatch_queue_t workerQueue = dispatch_queue_create("QueueIdentifier", NULL);
dispatch_async(workerQueue, ^ {
// do something for network or any thing which is not using UI changes
dispatch_sync(dispatch_get_main_queue(), ^{
// change in UI run this code
// like hide HUD
// [HUD removeFromSuperview];
});
});
No comments:
Post a Comment