<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCell/menu(for:in:of:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCell(im)menuForEvent:inRect:ofView:"
  },
  "title" : "menu(for:in:of:)"
}
-->

# menu(for:in:of:)

Returns the menu associated with the cell and related to the specified event and frame.

```
func menu(for event: NSEvent, in cellFrame: NSRect, of view: NSView) -> NSMenu?
```

## Parameters

`event`

The event used to find the menu.

`cellFrame`

The cell’s rectangle. This rectangle indicates the region containing the cursor.

`view`

The view that manages the cell. This is usually the control object that owns the cell.

## Return Value

The menu associated with the cell and event parameters, or `nil` if no menu is set.

## Discussion

This method is usually invoked by the [`NSControl`](/documentation/AppKit/NSControl) object (`aView`) managing the receiver. The default implementation gets the value of the [`menu`](/documentation/AppKit/NSCell/menu) property and returns `nil` if no menu has been set. Subclasses can override to customize the returned menu according to the event received and the area in which the mouse event occurs.

---

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)