Re: Wiring up MainMenu.xib
Re: Wiring up MainMenu.xib
- Subject: Re: Wiring up MainMenu.xib
- From: Scott Ribe <email@hidden>
- Date: Sun, 19 Oct 2014 08:50:31 -0600
Sorry, duh, you wire it up to "First Responder".
On Oct 19, 2014, at 8:47 AM, Scott Ribe <email@hidden> wrote:
> 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 <email@hidden> 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 (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
>
>
> --
> Scott Ribe
> email@hidden
> http://www.elevated-dev.com/
> (303) 722-0567 voice
>
>
>
>
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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