I have a problem: I used AFNetworking to get data from server, i used NSOperationQueue to add many operation to it, in each request, I added this operation to queue and used waitUntilAllOperationsAreFinished
as bellow :
request 1
...
[queue addOperation:operation1];
[queue waitUntilAllOperationsAreFinished];
request 2
...
[queue addOperation:operation2];
[queue waitUntilAllOperationsAreFinished];
I tried above code and my programs seems hangs and after that, it runs ok.So that I want to added MBProgressHUD to waiting queue finish, then I want to check if queue finish, I want to hide MBProgressHUD. But when i click on Button to load UIViewController, MBProgressHUD cannot show.
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = @"Loading";
Actually, I want to show MBProgressHUD when queue finish. How can i do that? Thanks all
Shortly you can do it like this:
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[MBProgressHUD hideHUDForView:self.view animated:YES];
Check MBProgressHUD
's usage