<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSComboBoxCell",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSComboBoxCell"
  },
  "title" : "NSComboBoxCell"
}
-->

# NSComboBoxCell

The user interface of a combo box.

```
class NSComboBoxCell
```

## Overview

[`NSComboBoxCell`](/documentation/AppKit/NSComboBoxCell) is a subclass of [`NSTextFieldCell`](/documentation/AppKit/NSTextFieldCell) used to implement the user interface of “combo boxes” (see [`NSComboBox`](/documentation/AppKit/NSComboBox) for information on how combo boxes look and work). The [`NSComboBox`](/documentation/AppKit/NSComboBox) subclass of [`NSTextField`](/documentation/AppKit/NSTextField) uses a single [`NSComboBoxCell`](/documentation/AppKit/NSComboBoxCell), and essentially all of the [`NSComboBox`](/documentation/AppKit/NSComboBox) class’s methods simply invoke the corresponding [`NSComboBoxCell`](/documentation/AppKit/NSComboBoxCell) method.

Also see the [`NSComboBoxCellDataSource`](/documentation/AppKit/NSComboBoxCellDataSource) protocol, which declares the methods that an [`NSComboBoxCell`](/documentation/AppKit/NSComboBoxCell) object uses to access the contents of its data source object.

## Topics

### Setting Display Attributes

[`hasVerticalScroller`](/documentation/AppKit/NSComboBoxCell/hasVerticalScroller)

A Boolean value that indicates if the combo box displays a vertical scroller.

[`isButtonBordered`](/documentation/AppKit/NSComboBoxCell/isButtonBordered)

A Boolean value that indicates whether the combo box button displays a border.

[`intercellSpacing`](/documentation/AppKit/NSComboBoxCell/intercellSpacing)

The spacing between cells in the combo box’s pop-up list.

[`itemHeight`](/documentation/AppKit/NSComboBoxCell/itemHeight)

The height of each item in the combo box’s pop-up list.

[`numberOfVisibleItems`](/documentation/AppKit/NSComboBoxCell/numberOfVisibleItems)

The maximum number of items visible in the pop-up list at any one time.

### Accessing a Data Source

[`dataSource`](/documentation/AppKit/NSComboBoxCell/dataSource)

The object that provides the data displayed in the combo box’s pop-up list.

[`usesDataSource`](/documentation/AppKit/NSComboBoxCell/usesDataSource)

A Boolean value that indicates if the combo box uses an external data source to populate its pop-up list.

### Working with an Internal List

[`addItems(withObjectValues:)`](/documentation/AppKit/NSComboBoxCell/addItems(withObjectValues:))

Adds multiple objects to the internal item list.

[`addItem(withObjectValue:)`](/documentation/AppKit/NSComboBoxCell/addItem(withObjectValue:))

Adds the specified object to the internal item list.

[`insertItem(withObjectValue:at:)`](/documentation/AppKit/NSComboBoxCell/insertItem(withObjectValue:at:))

Inserts an object at the specified location in the internal item list.

[`objectValues`](/documentation/AppKit/NSComboBoxCell/objectValues)

The combo box’s internal item list in an array.

[`removeAllItems()`](/documentation/AppKit/NSComboBoxCell/removeAllItems())

Removes all items from the combo box’s internal item list.

[`removeItem(at:)`](/documentation/AppKit/NSComboBoxCell/removeItem(at:))

Removes the object at the specified location from the combo box’s internal item list.

[`removeItem(withObjectValue:)`](/documentation/AppKit/NSComboBoxCell/removeItem(withObjectValue:))

Removes all occurrences of the specified object from the combo box’s internal item list.

[`numberOfItems`](/documentation/AppKit/NSComboBoxCell/numberOfItems)

The total number of items in the pop-up list.

### Manipulating the Displayed List

[`indexOfItem(withObjectValue:)`](/documentation/AppKit/NSComboBoxCell/indexOfItem(withObjectValue:))

Searches the combo box’s internal item list for the given object and returns the matching index number.

[`itemObjectValue(at:)`](/documentation/AppKit/NSComboBoxCell/itemObjectValue(at:))

Returns the object located at the specified location in the internal item list.

[`noteNumberOfItemsChanged()`](/documentation/AppKit/NSComboBoxCell/noteNumberOfItemsChanged())

Informs the combo box that the number of items in its data source has changed.

[`reloadData()`](/documentation/AppKit/NSComboBoxCell/reloadData())

Marks the combo box as needing redisplay, so that it will reload the data for visible pop-up items and draw the new values.

[`scrollItemAtIndexToTop(_:)`](/documentation/AppKit/NSComboBoxCell/scrollItemAtIndexToTop(_:))

Scrolls the combo box’s pop-up list vertically so that the item at the given index is as close to the top as possible.

[`scrollItemAtIndexToVisible(_:)`](/documentation/AppKit/NSComboBoxCell/scrollItemAtIndexToVisible(_:))

Scrolls the combo box’s pop-up list vertically so that the item at the given index is visible.

### Manipulating the Selection

[`deselectItem(at:)`](/documentation/AppKit/NSComboBoxCell/deselectItem(at:))

Deselects the pop-up list item at the given index if it’s selected.

[`indexOfSelectedItem`](/documentation/AppKit/NSComboBoxCell/indexOfSelectedItem)

The index of the last item selected from the pop-up list.

[`objectValueOfSelectedItem`](/documentation/AppKit/NSComboBoxCell/objectValueOfSelectedItem)

The object corresponding to the last item selected from the pop-up list.

[`selectItem(at:)`](/documentation/AppKit/NSComboBoxCell/selectItem(at:))

Selects the pop-up list row at the given index.

[`selectItem(withObjectValue:)`](/documentation/AppKit/NSComboBoxCell/selectItem(withObjectValue:))

Selects the first pop-up list item that corresponds to the specified object.

### Completing the Text Field

[`completedString(_:)`](/documentation/AppKit/NSComboBoxCell/completedString(_:))

Returns a string from the combo box’s pop-up list that starts with the given substring.

[`completes`](/documentation/AppKit/NSComboBoxCell/completes)

A Boolean value that indicates if the combo box tries to complete text entered by the user.



---

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)