NSTableView가 배열 컨트롤러 (사전 배열 관리)에 바인딩 된 간단한 인터페이스를 초기화하고 있습니다. 배열에 대한 내용을 백그라운드에서로드하려고합니다 (시간이 많이 소요되는 프로세스입니다). 100 또는 1000 개 요소마다 테이블 뷰를 업데이트하고 싶습니다. 아이디어는 인터페이스가 사용 가능하고 반응 적이라는 것입니다. 나중에 업데이트/새로 고침을 트리거하는 방법을 알 수 없습니다. 테이블은 비어 있습니다. 누구든지 포인터를 제공 할 수 있습니까? 난 그냥 직접 데이터를로드, 백그라운드에서 모든 것이 잘 작동 그렇게하려고하지 않는 경우인터페이스를 차단하지 않고 NSTableView에 대한 데이터를로드하려면 어떻게해야합니까?
// In init for my app controller. This seems to work well, but I've tried other methods here.
[self performSelectorInBackground:@selector(loadTable) withObject:nil];
- (void)loadTable {
tracks = [[NSMutableArray alloc] initWithCapacity:[masters count]];
// ... create each object one-by-one. Add it to tracks.
for (... in ...) {
[tracks addObject:newObject];
}
// Now I don't know what to do next. The table remains empty.
// Things I've tried (though possibly not in all combinations with the
// method above):
// 1. With a suitably-defined reloadData method, which just reloads
// the table view and sets needs display.
[self performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
// 2. Reload directly.
[tv reloadData];
[tv setNeedsDisplay];
}
하지만 거의 30 대를 취합니다
내 현재의 접근 방식이다.