NSTableView单元格编辑:在哪里执行编辑后操作?

ane*_*yzm 1 macos cocoa nstableview

NSTableView通过直接选择单元格(NSTextFieldCell)并编辑其中的文本来修改a的源数据.

我需要在编辑单元格之前和之后对单元格执行一些操作.我在编辑之前执行这样的操作:

- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
Run Code Online (Sandbox Code Playgroud)

但是我在哪里可以执行编辑后的操作?

谢谢

Tyl*_*ong 5

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/index.html#//apple_ref/occ/intfm/NSTableViewDataSource/tableView:setObjectValue:forTableColumn:row:

- (void)tableView:(NSTableView *)aTableView
   setObjectValue:(id)anObject
   forTableColumn:(NSTableColumn *)aTableColumn
              row:(NSInteger)rowIndex
Run Code Online (Sandbox Code Playgroud)

引用自:https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/TableView/PopulatingCellTables/PopulatingCellTables.html

为了让您的应用程序编辑基于NSCell的表视图的内容,您可以实现tableView:setObjectValue:forTableColumn:row:数据源协议方法.此方法类似于tableView:objectValueForTableColumn:row:,它提供表视图的数据,但不是请求您返回指定行和列的值,而是为该行和单元格提供新值