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

# NSPopUpButtonCell

The `NSPopUpButtonCell` class defines the visual appearance of pop-up buttons that display pop-up or pull-down menus. Pop-up menus present the user with a set of choices, much the way radio buttons do, but using much less space. Pull-down menus also provide a set of choices but present the information in a slightly different way, usually to provide a set of commands from which the user can choose.

```
class NSPopUpButtonCell
```

## Overview

The `NSPopUpButtonCell` class implements the user interface for the [`NSPopUpButton`](/documentation/AppKit/NSPopUpButton) class.

Changes made to a menu (such as adding, removing, or changing the items) are not apparent while the menu is being displayed or interacted with.

> Important: Setting a pop up button’s ``doc://com.apple.appkit/documentation/AppKit/NSCell/image`` property has no effect. The image displayed in a pop up button is taken from the selected menu item (in the case of a pop up menu) or from the first menu item (in the case of a pull-down menu).

## Topics

### Initialization

[`-  initTextCell:pullsDown:`](/documentation/AppKit/NSPopUpButtonCell/init(textCell:pullsDown:))

Returns an `NSPopUpButtonCell` object initialized with the specified title.

### Accessing menu attributes

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

The pop-up button’s associated menu.

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

A Boolean value that indicates the behavior of the button’s menu.

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

A Boolean value that indicates if the button automatically enables and disables its items every time a user event occurs.

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

The edge of the cell from which the menu should pop out when screen conditions are restrictive.

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

A Boolean value that indicates if the control uses an item from the menu for its own title.

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

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

The position of the arrow displayed on the button.

### Adding and removing items

[`-  addItemWithTitle:`](/documentation/AppKit/NSPopUpButtonCell/addItem(withTitle:))

Adds an item with the specified title to the end of the menu.

[`-  addItemsWithTitles:`](/documentation/AppKit/NSPopUpButtonCell/addItems(withTitles:))

Adds multiple items to the end of the menu.

[`-  insertItemWithTitle:atIndex:`](/documentation/AppKit/NSPopUpButtonCell/insertItem(withTitle:at:))

Inserts an item at the specified position in the menu.

[`-  removeItemWithTitle:`](/documentation/AppKit/NSPopUpButtonCell/removeItem(withTitle:))

Removes the item with the specified title from the menu.

[`-  removeItemAtIndex:`](/documentation/AppKit/NSPopUpButtonCell/removeItem(at:))

Removes the item at the specified index.

[`-  removeAllItems`](/documentation/AppKit/NSPopUpButtonCell/removeAllItems())

Removes all items in the receiver’s item menu.

### Accessing the items

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

An array of [`NSMenuItem`](/documentation/AppKit/NSMenuItem) objects that represent the items in the menu.

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

The number of items in the menu.

[`-  indexOfItem:`](/documentation/AppKit/NSPopUpButtonCell/index(of:))

Returns the index of the specified menu item.

[`-  indexOfItemWithTitle:`](/documentation/AppKit/NSPopUpButtonCell/indexOfItem(withTitle:))

Returns the index of the item with the specified title.

[`-  indexOfItemWithTag:`](/documentation/AppKit/NSPopUpButtonCell/indexOfItem(withTag:))

Returns the index of the menu item with the specified tag.

[`-  indexOfItemWithRepresentedObject:`](/documentation/AppKit/NSPopUpButtonCell/indexOfItem(withRepresentedObject:))

Returns the index of the menu item that holds the specified represented object.

[`-  indexOfItemWithTarget:andAction:`](/documentation/AppKit/NSPopUpButtonCell/indexOfItem(withTarget:andAction:))

Returns the index of the menu item with the specified target and action.

[`-  itemAtIndex:`](/documentation/AppKit/NSPopUpButtonCell/item(at:))

Returns the menu item at the specified index.

[`-  itemWithTitle:`](/documentation/AppKit/NSPopUpButtonCell/item(withTitle:))

Returns the menu item with the specified title.

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

The last item in the menu.

### Dealing with selection

[`-  selectItem:`](/documentation/AppKit/NSPopUpButtonCell/select(_:))

Selects the specified menu item.

[`-  selectItemAtIndex:`](/documentation/AppKit/NSPopUpButtonCell/selectItem(at:))

Selects the item in the menu at the specified index.

[`-  selectItemWithTag:`](/documentation/AppKit/NSPopUpButtonCell/selectItem(withTag:))

Selects the menu item with the specified tag.

[`-  selectItemWithTitle:`](/documentation/AppKit/NSPopUpButtonCell/selectItem(withTitle:))

Selects the item with the specified title.

[`-  setTitle:`](/documentation/AppKit/NSPopUpButtonCell/setTitle(_:))

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

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

The menu item last selected by the user.

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

The index of the item last selected by the user.

[`-  synchronizeTitleAndSelectedItem`](/documentation/AppKit/NSPopUpButtonCell/synchronizeTitleAndSelectedItem())

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

### Title conveniences

[`-  itemTitleAtIndex:`](/documentation/AppKit/NSPopUpButtonCell/itemTitle(at:))

Returns the title of the item at the specified index.

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

An array of `NSString` objects containing the titles of every item in the menu.

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

The title of the item last selected by the user.

### Handling events and action messages

[`-  attachPopUpWithFrame:inView:`](/documentation/AppKit/NSPopUpButtonCell/attachPopUp(withFrame:in:))

Sets up the receiver to display a menu.

[`-  dismissPopUp`](/documentation/AppKit/NSPopUpButtonCell/dismissPopUp())

Dismisses the pop-up button’s menu by ordering its window out.

[`-  performClickWithFrame:inView:`](/documentation/AppKit/NSPopUpButtonCell/performClick(withFrame:in:))

Displays the receiver’s menu and track mouse events in it.

### Constants

[`ArrowPosition`](/documentation/AppKit/NSPopUpButton/ArrowPosition)

These constants are defined for use with the [`arrowPosition`](/documentation/AppKit/NSPopUpButtonCell/arrowPosition) property.

### Notifications

[`NSPopUpButtonCellWillPopUpNotification`](/documentation/AppKit/NSPopUpButtonCell/willPopUpNotification)

This notification is posted just before a pop-up menu is attached to its window frame.

### Initializers

[`-  initWithCoder:`](/documentation/AppKit/NSPopUpButtonCell/init(coder:))

## Relationships

### Conforms To

[`NSUserInterfaceItemIdentification`](/documentation/AppKit/NSUserInterfaceItemIdentification)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`Sendable`](/documentation/Swift/Sendable)

[`NSMenuItemValidation`](/documentation/AppKit/NSMenuItemValidation)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSAccessibilityProtocol`](/documentation/AppKit/NSAccessibilityProtocol)

[`NSAccessibilityElementProtocol`](/documentation/AppKit/NSAccessibilityElementProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSMenuItemCell`](/documentation/AppKit/NSMenuItemCell)

---

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)