Web サービスに接続し、カテゴリの配列を返す次のコードがあります。
SOAP Web サービスに次のラッパーを使用しています。
MBProgressHUD
..そして、アクティビティ インジケーターについては次のとおりです。
https://github.com/jdg/MBProgressHUD
接続して結果を取得していることを HUD プログレス インジケーターで示したいと思います。現在、目的の効果を達成するために使用MBProgressHUD
していますが、適切に機能していないことに気付きました。my 内の実際のセルtableView
が読み込まれて表示される前に、進行状況インジケーターが消えます。またMBProgressHUD
、アプリケーションのさまざまな領域で を使用しますが、通常は Web サービスに接続して結果を取得するたびに使用します。
以下のコードを修正して正しく動作させる方法について、誰かが私を正しい方向に導くことができますか? プログレス インジケーターが表示された後にコールバック メソッドが呼び出されることが関係している可能性があると思います。MBProgressHUD
コールバック メソッドで適切に実装する方法がよくわかりません。
これは、それを機能させようとする私の恐ろしい試みです。
- (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
}