popUp(positioning:at:in:)
Pops up the menu at the specified location.
Declaration
func popUp(positioning item: NSMenuItem?, at location: NSPoint, in view: NSView?) -> BoolParameters
- item:
The menu item to be positioned at the specified location in the view.
- location:
The location in the
viewcoordinate system to display the menu item. - view:
The view to display the menu item over.
Return Value
true if menu tracking ended because an item was selected, and false if menu tracking was cancelled for any reason.
Discussion
Displays the menu as a pop-up menu. The top left corner of the specified item (if specified, item must be present in the menu) is positioned at the specified location in the specified view, interpreted in the view’s own coordinate system.
If item is nil, the menu is positioned such that the top left of the menu content frame is at the given location.
If view is nil, the location is interpreted in the screen coordinate system. This allows you to pop up a menu disconnected from any window.