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

混江龙づ霸主 提交于 2019-12-12 03:22:00

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/9356863/document-xib-contains-two-windows-one-window-needs-to-be-a-preference-panel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!