私は正常に動作し、テーブルビューにデータを適切に表示するテーブルビュー (ファイル名- five.m ) を持っています。ユーザーが行を選択すると、同じ画面に進行状況インジケーターを表示するサブビューが追加されます。サブビューを追加すると、HTML データを解析して SQLite3 データベースに追加するバックグラウンド スレッドが開始されます。バックグラウンド スレッド、SQLIte データ挿入、HTML 解析はすべて正常に動作しています。終了すると、removeProgressInd メソッドで five.m に戻り、進行状況インジケーターが削除され、新しいテーブル ビュー (ファイル名 - TitleOnly.m) に移動します。removeProgressInd メソッドからすべての NSLog メッセージを確認できるため、正常に返されます。しかし、コードは進行状況インジケーターを停止せず、新しいテーブルビューに移動しません。コードはエラーなしで実行されます。removeProgressInd の代わりに viewDidLoad と viewDidAppear で同じコードを実行しようとしましたが、NSLog メッセージしか表示されません。これが私のコードです。
Five.m - テーブルビュー
{
// start ProgressInd
[self.view addSubview:self.progressInd];
// shows progress Indicator on screen when I run my app in simulator
// start Parsing Calculation in Background thread
if (appDelegate4.globalParsingCompletedFlag==@"0")
{
NSLog(@"starting backgroung thread- parsing calulation- because flag==0");
ParsingCalculation *parsC = [[ParsingCalculation alloc] init];
[queue addOperation:parsC];
[parsC performSelectorInBackground:@selector(main) withObject:nil];
[parsC release];
//successfully starts parsing in background
}
}
ParsingCalculation.m ファイル コード
- (void)main {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
//your code to do the operations...
appDelegate5=[[[UIApplication sharedApplication] delegate] retain];
NSLog(@"Now we are in ParsingCalulation.m");
//resultsFromURL is another method in parsingCalulation.m that does all parsing successfully
[self resultsFromURL:appDelegate5.globalLocationURL];
NSLog(@"Now we are moving back in Five.m -calling function removeProgressInd ");
[[Five shared] performSelectorOnMainThread:@selector(removeProgressInd)
withObject:nil
waitUntilDone:YES];
//it returns back to five.m successfully after finishing HTML Parsing
[pool release];
}
Five.m - removeProgressInd メソッド
-(void) removeProgressInd{
NSLog(@"Now we are back in Five.m -in function removeProgressInd ");
//remove progressInd from superview as parsing calculation has been completed
[progressInd stopAnimating];
[self.progressInd removeFromSuperview];
//move to TitleOnly.m tableview
NSLog(@"navigate to TitleOnly ");
TitleOnly *newView = [[TitleOnly alloc] initWithNibName:@"TitleOnly" bundle:nil];
[self.navigationController pushViewController:newView animated:YES];
[newView release];
}
エラーなしでコンソールに「navigate to TitleOnly」メッセージが表示されます。これは、[progressInd stopAnimating] および [self.progressInd removeFromSuperview] コマンドがこの NSLog メッセージの直前にあるため、エラーなしで正常に実行されたことを意味します。ただし、進行状況インジケーターは画面から削除されません。同様に、TitleOnly テーブルビューも表示されません。''
どうすれば修正できますか?問題はどこだ?私は何を間違っていますか?
できる限り早くご回答ください。