我已经开始使用 Dashcode 为我们的一些 Cocoa 工具编写一个显示报告数据的界面。我正在使用 Dashcode 数据源和绑定来填充 WebView 中的元素,到目前为止一切似乎都运行良好。
我的 dataSource 中的一个对象是我想以编程方式操作的对象数组。我可以很好地更改数组中的对象值,但是如果我想替换数组或数组中的任何对象,我的绑定表将无法观察添加的对象。
这是我认为可以让我轻松地用新内容替换绑定数组的代码:
var dataSource = dashcode.getDataSource("reportData");
var newDetailArray = testArray();
dataSource.setValueForKeyPath(newDetailArray, "content.detailArray");
但这会引发异常:
Exception while binding "content" to keypath "arrangedObjects " TypeError: Result of expression 'this.object.valueForKeyPath' [undefined] is not a function.
有什么我遗漏的东西可以让我轻松地以编程方式操作数组的内容吗?