将可见性绑定到 arrayController 选择

Binding visibility to arrayController selection

我有一个 NSTableView 绑定到 NSArrayController

我在 table 下方有两个按钮,只有当 table 上有一个元素 select 时才必须启用它们。

我 select 按钮并将 Availability Enabled 绑定到 Table1 Controller, selectedObjects 但我收到此错误

Cocoa Bindings: Cannot create BOOL from object <_NSCachedIndexSet: 0x60000023b4e0>(no indexes) of class _NSCachedIndexSet

很明显,因为 selectedObjectsNSIndexSet 而 属性 期待 Bool

事实上,如果 selectedObjects 不为零,则应启用按钮;如果 属性 为零,则应禁用按钮。

我该怎么做?我的意思是,从数组 属性 中创建一个布尔值,以便我可以绑定它。

Controller Key 设置为 selectedObjects 并将 Model Key path 设置为 @count