0

테이블 뷰 (파일 이름 -5.m)가 정상적으로 작동하고 테이블 뷰의 데이터를 올바르게 표시합니다. 사용자가 행을 선택하면 동일한 화면에 진행 표시기를 보여주는 하위보기가 추가됩니다. 하위 뷰를 추가하면 HTML 데이터를 구문 분석하여 SQLite3 데이터베이스에 추가하는 백그라운드 스레드가 시작됩니다. 백그라운드 스레드, SQLIte 데이터 삽입, HTML 구문 분석 모두 잘 작동합니다. 이제 작업이 끝나면 진행 표시기를 제거하고 새 테이블보기 (파일 이름 - TitleOnly.m)로 이동하는 removeProgressInd 메소드에서 5 분으로 돌아갑니다. 그것은 removeProgressInd 메소드의 모든 NSLog 메시지를 볼 수 있으므로 성공적으로 반환됩니다. 그러나 코드는 진행 표시기를 멈추지 않고 새로운 tableview로 이동하지 않습니다. 오류없이 코드가 실행됩니다. viewDidLoad 및 viewDidAppear에서 removeProgressInd 대신 동일한 코드를 실행하려고했지만 NSLog 메시지 만 표시됩니다. 여기 내 코드가있다.코드가 백그라운드 스레드에서 되돌아온 후에 작동하지 않습니다.

Five.m -의 tableview 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 테이블 뷰도 표시되지 않습니다. ''

어떻게 해결할 수 있습니까? 문제가 어디에 있습니까? 내가 도대체 ​​뭘 잘못하고있는 겁니까?

되도록 빨리 회신 해주십시오.

답변

관련 문제