I have a custom NSTableRowView
implementation to display my data cells. The table also contains group rows using a simple NSTextField
.
In my custom row view I need to change the drawing of the bottom separator slightly depending on if the next row below is a data cell (i.e. my custom row) or a group header.
In the case of a group header I don't have to draw the separator, otherwise I'll end up with a 2px separator like shown in the screenshot.
Is there a way to get a reference to the next (or previous) NSTableRowView
instance from [NSTableRowView drawBackgroundInRect:...]
?
Am I correct that your table view delegate implements -tableView:rowViewForRow:
?
If so, let the table view delegate help:
drawsSeparator
to your custom row class.drawRect
and adjust your drawing accordingly.drawsSeparator
on your row in rowViewForRow
. You can invoke -tableView:isGroupRow:
with row + 1
to determine whether the next row is a group (after checking to make sure you're not on the last row).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With