0

テーブルビュー(ファイル名-5.m)が正しく動作し、テーブルビューでデータが正しく表示されています。ユーザーが行を選択すると、同じ画面に進捗インジケーターが表示されたサブビューが追加されます。サブビューを追加すると、HTMLデータを解析してSQLite3データベースに追加するバックグラウンドスレッドが開始されます。バックグラウンドスレッド、SQLIteデータ挿入、HTML解析はすべてうまくいきます。今度は終了するとremoveProgressIndメソッドのfive.mに戻り、進行状況インジケータを削除して新しいテーブルビュー(ファイル名 - TitleOnly.m)に移動します。これは、removeProgressIndメソッドからのすべてのNSLogメッセージを見ることができるので、正常に戻ります。しかし、コードは進捗インジケータを停止せず、新しいテーブルビューに移動しません。コードはエラーなしで実行されます。私はviewDidLoadとviewDidAppearの代わりにremoveProgressIndの同じコードを実行しようとしましたが、NSLogメッセージしか表示されません。ここに私のコードです。バックグラウンドスレッドから戻った後にコードが機能しない

Five.m - テーブルビューDidSelelectRow

{ 
    // 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 ([email protected]"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]; 


} 

コンソールで「TitleOnlyにナビゲート」メッセージが表示されることはありません。つまり、[progressInd stopAnimating]および[self.progressInd removeFromSuperview]コマンドは、このNSLogメッセージの直前にエラーが発生していないため、正常に実行されました。しかし、それは画面から進捗インジケータを削除しません。同様に、TitleOnlyテーブルビューも表示されません。 ''

どうすれば修正できますか?問題はどこだ?私は間違って何をしていますか?

できるだけ早くご返信ください。

答えて

関連する問題