Marking rows in NSTableView as dirty
-
29-01-2021 - |
Question
I subclassed NSTextFieldCell to do custom drawing and highlighting. I am essentially making a table with cells similar to the one found in Lion Mail, but my code is targeting Snow Leopard. The problem that I'm running into is this:
- user selects a cell (my cell draws a custom highlight)
- user scrolls the selected cell and all previously visible cells so that they are no longer visible in the table
- user selects an unselected cell (the new cell is highlighted)
- user scrolls the table such that the initially selected cell is visible again in the table
The last step is where the problem occurs; the initially selected cell is not being redrawn even though it is no longer selected. The consequence is that the cell appears to be selected.
What do I have to do to signal that unselected cells must be marked as dirty?
Solution
Use the selector setNeedsDisplay:
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow