Instance Method

popoverShouldDetach(_:)

Returns a Boolean value that indicates whether a popover should detach from its positioning view and become a separate window.

Declaration

optional func popoverShouldDetach(_ popover: NSPopover) -> Bool

Parameters

popover

The popover that may be detached.

Discussion

If you don't implement this method, it returns false by default. If you return true from this method, but you don't implement detachableWindow(for:) or you implement it to return nil, a detachable window is created with the popover’s contentViewController.

An automatically created window has the same appearance as the detached popover. For example, if the popover's contentViewController has a title, it will be bound to and displayed as the title of the detached window. When a popover is released in a detached state, it calls popoverDidDetach(_:) on the delegate. When a detached popover is closed, calls to popoverShouldClose(_:), popoverWillClose(_:), and popoverDidClose(_:), in addition to the related notifications, specify the reason standard.

See Also

Popover Visibility

func popoverShouldClose(NSPopover) -> Bool

Allows a delegate to override a close request.

func popoverWillShow(Notification)

Invoked when the popover will show.

func popoverDidShow(Notification)

Invoked when the popover has been shown.

func popoverWillClose(Notification)

Invoked when the popover is about to close.

func popoverDidClose(Notification)

Invoked when the popover did close.

func popoverDidDetach(NSPopover)

Indicates that a popover has been released while it's in an implicitly detached state.