popUpContextMenu(_:with:for:with:)
Displays a contextual menu over a view for an event using a specified font.
Declaration
class func popUpContextMenu(_ menu: NSMenu, with event: NSEvent, for view: NSView, with font: NSFont?)Parameters
- menu:
The menu object to use for the contextual menu.
- event:
An Nsevent object representing the event.
- view:
The view object over which to display the contextual menu.
- font:
An Nsfont object representing the font for the contextual menu. If you pass in
nilfor the font, the method uses the default font formenu.
Discussion
Specifying a font using the font parameter is discouraged. Instead, set the menu’s font using the font property, then pass nil for the font parameter.