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

# attachPopUp(withFrame:in:)

Sets up the receiver to display a menu.

```
func attachPopUp(withFrame cellFrame: NSRect, in controlView: NSView)
```

## Parameters

`cellFrame`

The cell’s rectangle, specified in points in the coordinate system of the view in the `controlView` parameter. The menu is attached to this rectangle.

`controlView`

The view in which to display the pop-up button’s menu.

## Discussion

This call sets up the popup button cell to display a menu, which occurs in [`performClick(withFrame:in:)`](/documentation/AppKit/NSPopUpButtonCell/performClick(withFrame:in:)). This method sets the cell’s control view and then highlights and redraws the cell. It does not show the menu.

This method also posts an [`willPopUpNotification`](/documentation/AppKit/NSPopUpButtonCell/willPopUpNotification). (The `NSPopUpButton` object sends a corresponding [`willPopUpNotification`](/documentation/AppKit/NSPopUpButton/willPopUpNotification).)

You normally do not call this method explicitly. It is called by the Application Kit automatically when the menu for the pop-up button is to be displayed.

---

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)