Search code examples
objective-ccocoacore-datansarraycontroller

Document.xib contains two windows, one window needs to be a preference panel


I have created a Document-Based Application using Core Data. I replaced the automatically created window in Document.xib with two windows: a "Panel" window and a "Window" window.

The "Panel" window contains a table view with bindings to an NSArrayController. The table view is used to add data to the array using the document class's entities and attributes. I would like to make this window act as a Preferences window. This window should appear when a button in the main "Window" is clicked.

The "Window" is my main window where I display data from the same NSArrayController using bindings. This window contains a button that I would like to use to make the "Panel" window appear.

I can hide the "Panel" window upon launch and only show the main "Window", but I can't figure out how to set the action of the button to show the "Panel" window.

Any thoughts on how to accomplish this??

I tried using two separate XIB files, but then I have a problem where I can't get the NSArrayController data into the other window.


Solution

  • Try connecting your button's action selector to your panel's makeKeyAndOrderFront: action.