Wiring up MainMenu.xib
Wiring up MainMenu.xib
- Subject: Wiring up MainMenu.xib
- From: Luther Baker <email@hidden>
- Date: Sun, 19 Oct 2014 09:36:45 -0500
I created a Document based app and Xcode created two XIB - MainMenu.xib and
Document.xib. Per the online docs for subclassing NSWindowController, I
created my own NSWindowController subclass and set that as the "File's
Owner" for the Document.xib and so far, everything has worked fine.
Now, I added two menu items to MainMenu.xib and I'd like to wire them up to
corresponding actions in my custom NSWindowController subclass, the "File's
Owner" in Document.xib.
In MainMenu.xib, I could drag an "Object" into MainMenu.xib and set it to
be the custom NSWindowController and then drag the menu items to the
corresponding IBActions and when the app starts those methods do indeed get
called but understandably, they get invoked on a different instance of
NSWindowController ... which doesn't have any of my other properties set.
What is the correct way to have menu items in MainMenu.xib invoke actions
in classes defined elsewhere? Specifically, the app's main
NSWindowController subclass which I generally wire up in the Document.xib
file?
Thanks,
-Luther
"Reasons To ... How to Subclass NSWindowController" ...
https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/KeyObjects/KeyObjects.html
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden