macos - NSTableView单元格编辑: where to perform post-editing operations?

标签 macos cocoa nstableview

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

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

- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex

但是在哪里可以进行后期编辑操作呢?

谢谢

最佳答案

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

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

For your app to edit the content of an NSCell-based table view, you implement the tableView:setObjectValue:forTableColumn:row: data source protocol method. This method is similar to tableView:objectValueForTableColumn:row:, which provides the data for the table view, but instead of requesting that you return a value for the specified row and column, it provides the new value for that row and cell

关于macos - NSTableView单元格编辑: where to perform post-editing operations?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19135043/

相关文章:

swift - 使用动画隐藏 NSStackView 的 View 项

c++ - 如何使用Qt Creator调试C++项目?

cocoa - 如何让我的 Cocoa 应用程序准确绘制设计师在 Sketch 中指定的颜色?

macos - 除了路径之外,Mac OS X 上还有哪些其他类型的持久文件引用?

objective-c - NSTableView:如何在右键单击时突出显示一个项目?

c++ - 如何指定程序可以在 C++ 中运行的最长时间

macos - Cython 在 Mac OS X 10.8 上编译/链接失败

objective-c - 尝试使用 NSString 但我在比较两个字符串时遇到问题

cocoa - 将核心数据实体绑定(bind)到 NSTableView : Model Key not working

objective-c - 为什么 reloadData 有效但 reloadItem 无效?