In my OSX app I'm subclassing NSTablRowView to make custom row selection color for my view based custom tableView.
I'm using following method overriding for that:
- (void)drawSelectionInRect:(NSRect)dirtyRect
I've noticed that this method is getting called all the time when at least one of the rows that is on screen is selected.
I'm curious if there is a way to not redraw the rows all the time, but do it only on row selection change?!
Any kind of help is highly appreciated!
I'm curious if there is a way to not redraw the rows all the time, but do it only on row selection change?!
The table view calls drawSelectionInRect:
exactly once after the selection has changed. (Provided that there are no excessive setNeedsDisplay calls)
drawRect:
on the other hand has to be called at least twice (1x for the deselected row and 1x for the newly selected one).
I noticed, that NSTableView
occasionally also redraws "in-between" rows when the selection changes. (e.g. rows 3-5 when the selection changes from row 2 to 6).