You don't need to wire that up in IB. You just need to implement the action in 
your window controller.

On Oct 19, 2014, at 8:36 AM, Luther Baker <lutherba...@gmail.com> wrote:

> 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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/scott_ribe%40elevated-dev.com
> 
> This email sent to scott_r...@elevated-dev.com


-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to