objective-c - 如何在两个 nib 文件之间共享 NSArrayController?

标签 objective-c cocoa cocoa-bindings nsarraycontroller

我有一组图像和两个 nib 文件。一个 nib 文件有一个在 NSTableView 中显示图像的窗口。另一个 nib 有一个窗口,可以将图像数组绘制到 NSView 中,并在所选图像上绘制高亮显示。

图像数组由 NSArrayController 控制。我无法让两个 Nib 共享 NSArrayController。我会有两个单独的 NSArrayControllers 绑定(bind)到相同的内容,但我也希望两个 nib 共享 Controller 的选择;也就是说,如果您在表格窗口中选择了一个图像,它也会在另一个窗口中被选中。

有没有标准的方法来做到这一点?

最佳答案

I would have two separate NSArrayControllers bound to the same content, but I also want both nibs to share the controller's selection; that is, if you select an image in the table window, it also becomes selected in the other window.

Is there a standard way to do this?

将两个单独的 NSArrayController 绑定(bind)到相同的内容和 selection indexes .

关于objective-c - 如何在两个 nib 文件之间共享 NSArrayController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2853931/

相关文章:

cocoa 获取电源适配器状态

multithreading - 使用 cocoa 装订线和线

objective-c - 绑定(bind)出了问题,无法找出原因

cocoa - 核心数据、NSTableColumn 绑定(bind)和自定义 NSCell

xcode - 有没有办法在 Swift 中更改 NSTextView 容器的字符串值?

c++ - 在 Mac OS 上禁用窗口

ios - 异步启动某些东西,然后仅在需要时等待它

iphone - 键/值更新字符串值

iphone - 多个图像的平滑 UIImageView 动画

ios - 如何从模态视图 Controller 传递参数?