I've looked through the related questions and have examined Apple's sample project but these examples do almost everything programmatically. I would prefer to do as much as possible in IB.
My question is: what is the general procedure to accomplish this?
NSView
subclass with the various
embedded UI elements. NSView
subclass in code. NSMenuItem
and then call the instance's setView:
method.I'm confused about setting FilesOwner in IB (is my custom NSView subclass FilesOwner in this case)?
Any clarification would be much appreciated.
I would create a new xib, if the custom view is more complex. If it is a very simple view, you can create it in code.
Regarding File's owner and structure, I would use a NSViewController
if the custom menu item view has its own xib file. Then instantiate this view controller in code and assign its view to the NSMenuItem
. That way you can handle organizational stuff through the controller and keep along the MVC paradigm.