Re: Slow scrolling after NSPopup implementation
Re: Slow scrolling after NSPopup implementation
- Subject: Re: Slow scrolling after NSPopup implementation
- From: Kyle Sluder <email@hidden>
- Date: Fri, 15 May 2009 06:12:29 -0400
On Fri, May 15, 2009 at 5:56 AM, Steven Hamilton <email@hidden> wrote:
> - (id)tableView:(NSTableView *)tableView
> objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
> {
> if ([[tableColumn identifier] isEqualToString:@"transfer"])
> {
> self.selectedTransferIndex = [[self.formattedTransactions
> objectAtIndex:row] objectForKey:@"transfer"];
> return nil;
Why are you setting this property inside of
-tableView:objectValueForTableColumn: ? This generates a ton of KVO
activity because this method is called very frequently. As the docs
say, it needs to be fast.
It looks like you're relying on this method being called first for the
"transfer" column to set your property to change your
NSArrayController's contents. Bad idea. Not only is it slow, but
it's logically incorrect and prone to breakage. What happens if
NSTableView decides to instead ask for the columns out-of-order?
NSTableView tries to minimize its redrawing work, so I would expect
this issue to arise at some point when only part of your table view
needs drawing.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden