---
title: "selectItem(at:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nspopupbuttoncell/selectitem(at:)"
---

# selectItem(at:)

Selects the item in the menu at the specified index.

## Declaration

```swift
func selectItem(at index: Int)
```

## Parameters

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

## Discussion

Discussion 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

### Related Documentation

- [altersStateOfSelectedItem](appkit/nspopupbuttoncell/altersstateofselecteditem.md)

### Dealing with selection

- [select(_:)](appkit/nspopupbuttoncell/select(_:).md)
- [selectItem(withTag:)](appkit/nspopupbuttoncell/selectitem(withtag:).md)
- [selectItem(withTitle:)](appkit/nspopupbuttoncell/selectitem(withtitle:).md)
- [setTitle(_:)](appkit/nspopupbuttoncell/settitle(_:).md)
- [selectedItem](appkit/nspopupbuttoncell/selecteditem.md)
- [indexOfSelectedItem](appkit/nspopupbuttoncell/indexofselecteditem.md)
- [synchronizeTitleAndSelectedItem()](appkit/nspopupbuttoncell/synchronizetitleandselecteditem().md)
