Instance Method


Selects the item in the menu at the specified index.


func selectItem(at index: Int)



The index of the item you want to select, or -1 you want to deselect all menu items.


By default, selecting or deselecting a menu item from a pop-up menu changes its state. Selecting a menu item from a pull-down menu does not automatically alter the state of the item. To disassociate the current selection from the state of menu items, set the altersStateOfSelectedItem property to false.

Subclassers can override this method to catch all select calls.

See Also

Dealing with selection

func select(NSMenuItem?)

Selects the specified menu item.

func selectItem(withTag: Int) -> Bool

Selects the menu item with the specified tag.

func selectItem(withTitle: String)

Selects the item with the specified title.

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.