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

# addItem(withTitle:)

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

```
func addItem(withTitle title: String)
```

## Parameters

`title`

The title of the menu-item entry. If an item with the same title already exists in the menu, the existing item is removed and the new one is added.

## Discussion

If you want to move an item, it’s better to invoke [`removeItem(withTitle:)`](/documentation/AppKit/NSPopUpButton/removeItem(withTitle:)) explicitly and then send this method. After adding the item, this method calls the [`synchronizeTitleAndSelectedItem()`](/documentation/AppKit/NSPopUpButton/synchronizeTitleAndSelectedItem()) method to make sure the item being displayed matches the currently selected item.

Since this method searches for duplicate items, it should not be used if you are adding an item to an already populated menu with more than a few hundred items. Add items directly to the receiver’s menu instead.

## See Also

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

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



---

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)