Avoid layout when providing cell values (fixes #73)

-tableView:objectValueForTableColumn:row: may call -layoutCandidateView,
which in turn may force the table view to reload; the layout code
should only run after all cell values are provided for to break this
potential cycle.
This commit is contained in:
Lukhnos Liu 2013-01-16 21:42:41 -08:00
parent d8203c2547
commit 54f0113c0c
1 changed files with 6 additions and 0 deletions

View File

@ -338,6 +338,12 @@ static const CGFloat kCandidateTextLeftMargin = 8.0;
} }
- (void)layoutCandidateView - (void)layoutCandidateView
{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(deferredLayoutCandidateView) object:nil];
[self performSelector:@selector(deferredLayoutCandidateView) withObject:nil afterDelay:0.0];
}
- (void)deferredLayoutCandidateView
{ {
NSUInteger count = [_delegate candidateCountForController:self]; NSUInteger count = [_delegate candidateCountForController:self];
if (!count) { if (!count) {