macos - 将 NSMutableArray 绑定(bind)到单个列 NSTableView 的简单方法是什么

标签 macos cocoa nsmutablearray cocoa-bindings nsarraycontroller

有没有一种简单的方法可以将由字符串组成的 NSMutableArray 绑定(bind)到单列 NSTableView 而无需创建任何新类?

最佳答案

在界面生成器中创建一个 NSArrayController。将其内容数组绑定(bind)到可变数组,如下所示:

Binding

然后将表列绑定(bind)到该数组 Controller ,如下所示:

Binding2

(请注意模型关键路径字段中的 self。这就是它可以处理字符串数组的原因。)

关于macos - 将 NSMutableArray 绑定(bind)到单个列 NSTableView 的简单方法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21290299/

相关文章:

ios - removeObjectAtIndex : is removing data from the main array and duplicate array as well

ios - 如何通过代码获取A1532这样的iPhone设备监控模型?

macos - MAC Slave-SSH连接失败

objective-c - NSString.length 给出 EXC_BAD_ACCESS

iphone - 相互比较数组元素,在重复项上将某个属性加在一起?

iphone - iOS - 无法访问 didSelectRowAtIndexPath 中的 NSMutableArray?

macos - Delphi fmx移动无边界表格

c++ - 如何在 Mac 上启用 C++17?

macos - 使用 View Controller 运行 mouseEntered 函数

macos - 在 MacOS 应用程序中呈现 NSViewController 工作正常,直到我存档构建