---
title: "menu(for:in:of:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscell/menu(for:in:of:)"
---

# menu(for:in:of:)

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

## Declaration

```swift
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

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

## Discussion

Discussion This method is usually invoked by the NSControl object (aView) managing the receiver. The default implementation gets the value of the 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.

## See Also

### Managing Menus

- [defaultMenu](appkit/nscell/defaultmenu.md)
- [menu](appkit/nscell/menu.md)
