5 Replies
      Latest reply on Feb 12, 2019 1:08 AM by packagesdev
      packagesdev Level 1 Level 1 (10 points)

        Context:

         

        View based NSTableView - OS X 10.10 and later.

         

        Problem:

         

        I want to change the background color of the displayed rows in a table view. Basically, I have a button in the window and when I click this button I want to change the background color of some rows.

         

        Well, this does not work.

         

        Things I've tried:

         

        1. Implementing tableView:didAddRowView:forRow: and tableView:didRemoveRowView:forRow:

         

        This does not work as these methods are not invoked when calling reloadData or reloadDataForRowIndexes:columnIndexes: .The change is only applied when a new row is added.

         

        And trying to lie with noteNumberOfRowsChanged does not help.

         

        2. Implementing tableView:rowViewForRow:

         

        This does not work, the background color set in this method was never taken into account when I tried this.

         

        Question:

         

        Am I missing something an obvious solution?