2012-06-22 2 views

답변

2

GCD (지원할 수없는 iOS 4.x 기능)를 사용하지 않으면이 질문에 쉽게 대답 할 수 없으므로 NSNotificationCenter을 사용하고 메소드가 끝난.

- (IBAction)onClick:(id)sender { 

    NSThread *thread = [[NSThread alloc]initWithTarget:parser selector:@selector(adapter:) object:ph]; 

    [thread start]; 
} 

-(void)adapter:(NSObject*)arg { 
    //... process and such 
    [[NSNotificationCenter defaultCenter]postNotification:[NSNotification notificationWithName:@"Thread_Done" object:nil]]; 

} 
+0

나는 통행 통행을 어떻게 볼 수 있는가? - (void) onPostExecute 메서드를 수행 한 후 스레드를 수행 한 방법을 알아낼 수 없다. - (void) adapter. – haawa

+0

간단합니다. 알림을 다음과 같이 바꾸십시오.'[self performSelectorOnMainThread : @selector (onPostExecute)];' – CodaFi

관련 문제