Instance Method


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?



The event used to find the menu.


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


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.


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

class var defaultMenu: NSMenu?

Returns the default menu for instances of the cell.

var menu: NSMenu?

The cell’s contextual menu.