I want to create logical groups by separating out the menu items in my sub menu.
Similar to the open with sub menu in Mac.
How can I achieve this.
NSMenuItem Separator Item creates a blank space, I require the visual to be the same as in the image attached.
I guess is, you are searching for Submenu Item. Find it in the Interface Builder by searching for submenu.
After inserting in the desired menu you find a new entry called Item. Just edit these and or fill in other menu items as you like. This creates a menu structure as you asked for!
I provided you a solution for your question. According to the Apple Docs Context menus are located in the views in which they belong. Call the method from the viewController `viewDidLoad. the selector method create as you need.
* Edit * Assign the created menu to the main menu. I did this in the
viewDidLoad
method. if you don't like to have it on the main menu on the top, just skip the two lines after the mainmenu comment. BTW the index is the position in which the menu get inserted in the mainmenu.I tested it and it works! Here the screenshot.
Hope it helps. And when it does, use the green answered menu :-)