0
votes

I have a NSTableView which has cells which can be edited, but when I change the text on them it just reverts back. What delegate call has the table view for making this changes? Couldn't find anything :(

1

1 Answers

4
votes

First, remember that the table view does not hold data. It just displays the data it gets from the datasource (which is your code).

When editing is complete, the table view will call its datasource (you) with the following method:

- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex

It is then your responsibility to update the model with this new value.

Afterwards, the tableview will ask the datasource for the value of this column and row. The datasource is responsible for responding with the correct value (the one you wrote back to the model above).