<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPopUpButtonCell/selectItem(at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPopUpButtonCell(im)selectItemAtIndex:"
  },
  "title" : "selectItem(at:)"
}
-->

# selectItem(at:)

Selects the item in the menu at the specified index.

```
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

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`](/documentation/AppKit/NSPopUpButtonCell/altersStateOfSelectedItem) property to <doc://com.apple.documentation/documentation/Swift/false>.

Subclassers can override this method to catch all select calls.

## See Also

[`altersStateOfSelectedItem`](/documentation/AppKit/NSPopUpButtonCell/altersStateOfSelectedItem)

A Boolean value that indicates if the pop-up button links the state of the selected menu item to the current selection.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)