Re: Redisplaying a NSTableColumn NSTableHeaderCell
Re: Redisplaying a NSTableColumn NSTableHeaderCell
- Subject: Re: Redisplaying a NSTableColumn NSTableHeaderCell
- From: Corbin Dunn <email@hidden>
- Date: Wed, 26 Jan 2011 09:43:43 -0800
On Jan 26, 2011, at 8:39 AM, Matt Patenaude wrote:
> Never prematurely optimize. To my knowledge, -reloadData is a pretty intelligent method and performs incremental updates only as necessary.
No, don't do that. For NSTableView, it can't be very intelligent. It has to requery everything from the datasource/delegate, since there is no knowledge of what row lives where. Granted, that is usually fast, but still, there is no reason to redraw everything.
-reloadDataForRowIndexes:columnIndexes: as a performant alternative, and all it is really does is a setNeedsDisplayInRect on the visible cells passed to it.
However, none of those things are Eric's problem. Graham answered it correctly:
> Have you tried [[theTable headerView] setNeedsDisplay:YES];?
Alternatively, you could do a setNeedsDisplayInRect on the headerView for just the column's portion.
corbin
> Have you tested it to see if your application takes a noticeable performance hit? If it doesn't, then don't second-guess the Cocoa frameworks.
>
> Regardless, I agree that it seems unnecessary. How are you changing the alignment?
>
> -Matt
>
> Sent from my iPhone
>
> On Jan 26, 2011, at 11:05 AM, Eric Gorr <email@hidden> wrote:
>
>> I found this old thread:
>>
>> refreshing the header title for an NSTableColumn
>> http://lists.apple.com/archives/cocoa-dev/2005/Nov/msg00659.html
>>
>> which describes the same problem I just faced.
>>
>> In my case, I needed to change the justification of the text in the header cell and calling setNeedsDisplay: on the table did not cause the header cell to redraw itself. My only option still appears to be telling the table to reload it's data. Of course, this could result in an unnecessary performance hit depending on how much work needs to be done when reloading the data.
>>
>> It is possible that -reloadDataForRowIndexes:columnIndexes: would cause the header cell to redraw if I just tell the first row and the column that changed to reload it's data, but I need to stay with the 10.5 SDK for the moment.
>>
>> I was only curious if there was some other better and more efficient method that I could use to get the header cell to redraw since this old thread from 2005.
>>
>> If there isn't, I'll file an enhancement request....it still would seem silly to need to call any reloadData method to get a header cell to redraw in this situation.
>>
>> _______________________________________________
>>
>> 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
> _______________________________________________
>
> 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
_______________________________________________
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