Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone - Help with MBProgressHUD, Sudzc, Web Services and NSThread
    primarykey
    data
    text
    <p>I have the following code, which connects to a web service and returns an array of Categories.</p> <p>I am using the following wrapper for SOAP web services:</p> <p><a href="http://www.sudzc.com/" rel="nofollow">http://www.sudzc.com/</a></p> <p>..and the following <code>MBProgressHUD</code> for the activity indicator:</p> <p><a href="https://github.com/jdg/MBProgressHUD" rel="nofollow">https://github.com/jdg/MBProgressHUD</a></p> <p>I would like to have a HUD progress indicator indicate that it's connecting and grabbing results. I'm currently using <code>MBProgressHUD</code> to achieve the desired effect, however I'm noticing that it's not quite working properly. The progress indicator disappears before the actual cells in my <code>tableView</code> are loaded and displayed. I also use the <code>MBProgressHUD</code> in different areas of my application, but usually every time I connect to the web service to grab results.</p> <p>Could someone lead me in the right direction as to how to fix the below code to work properly? I think it may relate to the fact that the callback method is fired after the progress indicator is displayed. Not quite sure how to implement <code>MBProgressHUD</code> properly with a callback method.</p> <p>This is my horrible attempt at "trying" to get it working.</p> <pre><code>- (void)showHUD { HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; // Add HUD to screen. [self.navigationController.view addSubview:HUD]; // Register for HUD callbacks so we can remove it from the window at the right time. HUD.delegate = self; HUD.labelText = @"Loading"; // Show the HUD while the provided method executes in a new thread [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 { // parse objects returned from array, populate array, reload table view data, etc } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload