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

# menu(for:)

Overridden by subclasses to return a context-sensitive pop-up menu for a given mouse-down event.

```
func menu(for event: NSEvent) -> NSMenu?
```

## Parameters

`event`

An object representing a mouse-down event.

## Discussion

The view can use information in the mouse event, such as its location over a particular element of the view, to determine what kind of menu to return. For example, a text object might display a text-editing menu when the cursor lies over text and a menu for changing graphics attributes when the cursor lies over an embedded image.

The default implementation returns the view’s normal menu.

## See Also

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

Returns the responder’s menu.



---

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)