objective-cmacoscocoanstableview

Update custom views in one column of NSTableView based on editing a cell in another


In the first column of my view-based NSTableView, I have a custom NSView subclass. In the second column, there's an NSTextField.

Now I would like to adjust the drawing of the view in the first column based on when I start editing one of the text fields of the second column. I've tried setting a property on the custom view in tableView:viewForTableColumn:row:, but this doesn't work, as the table cells are only updated when I call reloadData on the table view, which in turn ends editing. To make this even more complicated, I'd like to adjust the drawing of the custom view not only in the row I'm currently editing, but for all the rows.

Any ideas how to achieve this?


Solution

  • Use reloadDataForRowIndexes:columnIndexes: to limit reloading to the first column.