Reputation: 4139
I have a Main.xib, with the main window, the main menu, and a second menu with a name "StatusMenu" that connects nowhere.
In my application, I have an NSStatusItem, and I want to press it, and display that secondary menu.
How can I connect those two?
thanks
Upvotes: 1
Views: 1222
Reputation: 2932
You should add an Object to Interface Builder and connect the visible menu to it. This object can be any custom class with an appropriate @IBOutlet. Just set the class in the "Identity Inspector".
This way, loadin the Nib will create an instance of your object as well. You then have to make sure this object is itself connected to an outlet of, say, AppDelegate, or else you won't be able to access it.
Upvotes: 0
Reputation: 562
Create an IBOutlet for the status item menu, and then when you create the status item set its menu:
[statusItem setMenu: statusItemMenu];
Upvotes: 2