Instance Method


Selects the item with the specified title.


func selectItem(withTitle title: String)



The title of the item to select. If you specify an empty string, or a string that does not match the title of a menu item, this method deselects the currently selected item.


By default, selecting or deselecting a menu item changes its state. To disassociate the current selection from the state of menu items, set the altersStateOfSelectedItem property to false.

See Also

Dealing with selection

func select(NSMenuItem?)

Selects the specified menu item.

func selectItem(at: Int)

Selects the item in the menu at the specified index.

func selectItem(withTag: Int) -> Bool

Selects the menu item with the specified tag.

func setTitle(String?)

Sets the string displayed in the receiver when the user isn’t pressing the mouse button.

var selectedItem: NSMenuItem?

The menu item last selected by the user.

var indexOfSelectedItem: Int

The index of the item last selected by the user.

func synchronizeTitleAndSelectedItem()

Synchronizes the pop-up button’s displayed item with the currently selected menu item.