Instance Method

selectItemWithTag:

Selects the menu item with the specified tag.

Declaration

- (BOOL)selectItemWithTag:(NSInteger)tag;

Parameters

tag

The tag of the item you want to select.

Return Value

YES if the item was successfully selected; otherwise, NO.

Discussion

If no item with the specified tag is found, this method returns NO and leaves the menu state unchanged.

You typically assign tags to menu items from Interface Builder, but you can also assign them programmatically using the setTag: method of NSMenuItem.

See Also

Dealing with selection

- selectItem:

Selects the specified menu item.

- selectItemAtIndex:

Selects the item in the menu at the specified index.

- selectItemWithTitle:

Selects the item with the specified title.

- setTitle:

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

selectedItem

The menu item last selected by the user.

indexOfSelectedItem

The index of the item last selected by the user.

- synchronizeTitleAndSelectedItem

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