Re: NSTableView - Detecting when user has finished scrolling
Re: NSTableView - Detecting when user has finished scrolling
- Subject: Re: NSTableView - Detecting when user has finished scrolling
- From: Peter Hudson <email@hidden>
- Date: Thu, 01 Oct 2015 08:04:08 +0100
Legacy code I’m afraid Graham - written some years ago.
I simply want it to look better for now while we're getting on with the re-write.
The new version indeed uses view-based table views - and works a lot better.
Peter
> On 1 Oct 2015, at 01:11, Graham Cox <email@hidden> wrote:
>
>
>> On 30 Sep 2015, at 10:20 pm, Peter Hudson <email@hidden> wrote:
>>
>> As the user scrolls one of the table views, the system does not render all the details in the rows correctly.
>> The most obvious one :- I draw my own lines between rows - inserting separator lines where appropriate.
>> Hence, I override drawRect. The process in here to calculate the placement of lines is too long - hence the system, on occasions, will not draw them.
>
>
> Really sounds like you’re Doing It Wrong™. If you’re using a view-based table (as is recommended these days) then the row view should be drawing this separator line (a given row could be flagged to include a separator if it only applies to some of them). NSTableView also supports various kinds of group rows and overlays if that is a better fit. There are also some delegate methods that are intended to be used for drawing the backgrounds of rows which could also be used. Overriding -drawRect: on NSTableView is invariably a no-no.
>
> If calculating which row is a separator is taking a long time, there’s something seriously fishy about your code, as that sort of calculation should be trivial. For example, if you are adding up the heights of all possible rows above the line, you’re probably doing far too much work - the table already knows which views are visible and where they are, so there should only be a few to consider at most.
>
> —Graham
>
>
_______________________________________________
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