D3ATH
D3ATH

Reputation: 31

How to edit Main Menu menu bar in Mac application?

Already I created a Mac app for my site but I can't find any guide on how to edit the Menu Bar items.

The only results I get are on how to make a status bar application.

I'd like to add items to the app's Main Menu: App Name | File | Edit | View | etc.

How can I add items to the main menu bar menu and then trigger actions when selected?

Upvotes: 1

Views: 1612

Answers (2)

Stuart
Stuart

Reputation: 11

Apparently, for XCode 11, though you may think that the "menu bar" would be full of "menus," they are actually called "items." For each ITEM on the menu bar, you can have a menu associated.

  1. First, add an item to the menu bar. It will have a name ("Item"), but the name won't be visible in the bar. Instead, you will see a blue placeholder.
  2. You can now add a menu to the newly created item. By default, you should see three nameless sub-items (1, 2, and 3).
  3. Name your new menu, and it should become visible in the menu bar.

Once you've managed to get your menu into the menu bar, it is easy enough to add menu items to it, move it, etc. I've found it easiest to drop the items into the hierarchical display of the xib on the left rather than onto the menu bar picture in the main editor.

Upvotes: 1

GoodSp33d
GoodSp33d

Reputation: 6282

Just open MainMenu.xib and in the left navigation area expand Menu(under Objects) and you can find all Menu Items that appear on top here.

enter image description here

To add your own menu item drag a new menu item to this main menu. There are a lot of options for you to choose from:

enter image description here

Edit the menu items and add Actions like how you do it for any other object in Xib.

enter image description here

Upvotes: 4

Related Questions