Search code examples
objective-ccocoanibnsmenunsstatusitem

load a menu from nib


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


Solution

  • Create an IBOutlet for the status item menu, and then when you create the status item set its menu:

    [statusItem setMenu: statusItemMenu];