Where should document-related actions for a Cocoa app be implemented?
Posted
by Adam Preble
on Stack Overflow
See other posts from Stack Overflow
or by Adam Preble
Published on 2010-03-20T15:18:20Z
Indexed on
2010/03/20
15:21 UTC
Read the original article
Hit count: 249
I'm writing a document-based Cocoa app that's basically a graphical editing program. I want the user to be able to show/hide non-modal windows (such as an inspector window). Since these windows would be shown/hidden from menu items, where is the "best" place to implement the actions, such as - (IBAction)toggleInspector:(id)sender
?
I've seen that in the Sketch example code these are implemented in the app delegate, and the window controller instances are kept there as well, but that feels like more of a convenient place to put it than the most "graceful" place. Additionally, since this inspector would only be relevant when a document is open it feels like it should be associated more with the document's main NSWindowController
than the app.
© Stack Overflow or respective owner