Tom Dalling
Tom Dalling

Reputation: 24125

How do I share an NSArrayController between two nib files?

I have an array of images, and two nib files. One nib file has a window that displays the images in an NSTableView. The other nib has a window that draws the array of images into an NSView, and also draws a highlight over the images that are selected.

The array of images is controlled by an NSArrayController. I'm having trouble getting the two nibs to share the NSArrayController. 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?

Upvotes: 5

Views: 1683

Answers (1)

Peter Hosey
Peter Hosey

Reputation: 96323

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?

Have two separate NSArrayControllers bound to the same content and selection indexes.

Upvotes: 5

Related Questions