Show / Hide menu in MenuBar

At launch, several menus of the menuBar are hidden (defined in IB).


I want to show them later. How can I do this ?


For NSMenuItems, I use the hidden property, but there is no such property for NSMenu.


What's the way to di it ?

Answered by Claude31 in 123045022

Solved.


a menu in MenuBar has both a

- NSMenu

- NSMenuItem

that defines it


In IB, such a menu in menu bar has the following structiure :

- NSMenuItem

- NSMenu

- its NSMenuItems


With outlets in IB such as :

    @IBOutlet weak var fileMenu: NSMenu!    // menu structure
    @IBOutlet weak var fileMenuItem: NSMenuItem! // item in menuBar

FileMenuItem.hidden = false // or true will hide / show the menu in menu bar
Accepted Answer

Solved.


a menu in MenuBar has both a

- NSMenu

- NSMenuItem

that defines it


In IB, such a menu in menu bar has the following structiure :

- NSMenuItem

- NSMenu

- its NSMenuItems


With outlets in IB such as :

    @IBOutlet weak var fileMenu: NSMenu!    // menu structure
    @IBOutlet weak var fileMenuItem: NSMenuItem! // item in menuBar

FileMenuItem.hidden = false // or true will hide / show the menu in menu bar
Show / Hide menu in MenuBar
 
 
Q