당신을 당신의 큰 responce
하라구요 기다리는 방법
가능성이 원하지 않는 멀티 스레드 수행하는 방법 데이터 ... 의 구문 분석 후 행의 선택을 가능하게하는 방법 최소한 NSThreads를 사용하는 것. 당신이 할 일은 NSOperation의 서브 클래스입니다.
염두에 두어야 할 몇 가지 방법이 있습니다. 테이블에서 처음부터 행의 총 수를 알면 간단합니다.
MyParseDataOperation이라는 NSOperation의 하위 클래스를 만듭니다. 그런 다음 테이블의 각 행에 대해 하나의 MyParseDataOperation을 만듭니다. 작업이 완료되면 주 스레드에 결과 데이터를 메시지로 보내야합니다.
아래 코드에는 오류가 가득합니다. 불완전합니다. 당신의 MyParseDataOperation 클래스 등
예 :
MyParseDataOperation
-(id)initWithStuff:(NSURL*)stuff forTableRow:(int)row;
{
blah blah -
// here is where I make sure I have all the data I need for main() which is called in the background on some random thread at some future time.
}
-(void)main;
{
// use data like Urls, file names, etc passed in to the initWithStuff method
get stuff
parse stuff
// ok now you have the data
NSMutableDictionary* parsedData = [NSMutableDictionary dictionary];
[parsedData setObject:[NSNumber numberWithInt:row] forKey:@"row"];
[parsedData setObject:stuff i figured out forKey:@parsed];
[tableDataSource performSelectorOnMainThread:@selector(dataParsed) withObject:parsedData];
}