NSTableView - trying to redraw one row

I have an NSTableView, and I am trying to redraw one row of it when its data changes.


I've tried both of these:


table.reloadData(forRowIndexes:IndexSet(integer:row) , columnIndexes: IndexSet(integer:0))


table.drawRow(row, clipRect:table.bounds)


But it is not ever calling the draw function for the table row cell. The actual item associated with the table row has not changed -- is that why it is not updating? Some sub-data within the item has changed, that's why it needs to be redrawn.


Anyone know what the problem could be?

Thanks!

Accepted Reply

I got this fixed this way:


if let selectedView = table.view(atColumn: 0, row: row, makeIfNecessary: false) {

selectedView.setNeedsDisplay(selectedRow.bounds)

}

Replies

Did you try

drawCell(atRow:column:)


without clipping.

I don't see that function in the documentation?

I got this fixed this way:


if let selectedView = table.view(atColumn: 0, row: row, makeIfNecessary: false) {

selectedView.setNeedsDisplay(selectedRow.bounds)

}