I have the following code that connects to a web service and returns an array of categories.
I use the following shell for SOAP web services:
http://www.sudzc.com/
.. and MBProgressHUDfor the activity indicator:
https://github.com/jdg/MBProgressHUD
I would like the HUD progress indicator to indicate that it connects and captures the results. Currently, I use MBProgressHUDto achieve the desired effect, but I notice that it does not work correctly. The progress bar disappears before the actual cells in mine are loaded and displayed tableView. I also use MBProgressHUDin different areas of my application, but usually every time I connect to a web service to get results.
Can someone lead me in the right direction regarding how to fix the code below to work correctly? I think this may relate to the fact that the callback method runs after the progress indicator is displayed. Not quite sure how to implement it correctly MBProgressHUDusing the callback method.
This is my terrible attempt to "try" to make it work.
- (void)showHUD {
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = @"Loading";
[HUD showWhileExecuting:@selector(runLocalNotificationHandler) onTarget:self withObject:nil animated:YES];
}
- (void)runLocalNotificationHandler {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self performSelectorOnMainThread:@selector(connectToService) withObject:nil waitUntilDone:YES];
[pool release];
}
- (void)connectToService {
Service1 *service = [[Service1 alloc] init];
[service GetCategories:self action:@selector(handlerGetCategories:)];
[service release];
}
- (void)handlerGetCategories:(id)value {
}
source
share