NSPopoverDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.7 and later.
Declared in
NSPopover.h
Related sample code

Overview

The NSPopoverDelegate protocol defines optional methods that can be implemented by an NSPopover delegate class to provide additional or custom functionality.

See NSPopover Class Reference for more information on popovers in general.

Tasks

Popover Window

Popover Visibility

Instance Methods

detachableWindowForPopover:

Detaches the popover creating a window containing the content.

- (NSWindow *)detachableWindowForPopover:(NSPopover *)popover
Parameters
popover

The popover.

Return Value

Returns a window instance to which the popover should be detached.

Discussion

You should not remove the popover's content view as part of your implementation of this method.

The popover and the detachable window may be shown at the same time and therefore cannot share a content view or content view controller.

If the popover and the detachable window should have the same content, you should define the content in a separate nib file and use a view controller to instantiate separate copies of the content for the popover and the detachable window.

The popover will animate to appear as though it morphs into the detachable window (unless the popover’s animates property is set to NO). The exact animation used is not guaranteed.

If there is no delegate, the delegate does not implement this method, or the delegate returns nil, the popup will not be displayed detached.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSPopover.h

popoverDidClose:

Invoked when the popover did close.

- (void)popoverDidClose:(NSNotification *)notification
Discussion

Invoked on the delegate when the NSPopoverDidCloseNotification notification is sent.

This method will also be invoked on the delegate’s popover, if the method has been implemented.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSPopover.h

popoverDidShow:

Invoked when the popover has been shown.

- (void)popoverDidShow:(NSNotification *)notification
Discussion

Invoked on the delegate when the NSPopoverDidShowNotification notification is sent.

This method will also be invoked on the delegate’s popover, if the method has been implemented.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSPopover.h

popoverShouldClose:

Allows a delegate to override a close request.

- (BOOL)popoverShouldClose:(NSPopover *)popover
Parameters
popover

The popover.

Return Value

YES if the popover should close, NO otherwise.

Discussion

The popover invokes this method on its delegate whenever it is about to close. This gives the delegate a chance to override the close.

If there is no delegate or the delegate does not implement this method the default behavior is that the popover will close.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSPopover.h

popoverWillClose:

Invoked when the popover is about to close.

- (void)popoverWillClose:(NSNotification *)notification
Discussion

Invoked on the delegate when the NSPopoverWillCloseNotification notification is sent.

This method will also be invoked on the delegate’s popover, if the method has been implemented.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSPopover.h

popoverWillShow:

Invoked when the popover will show.

- (void)popoverWillShow:(NSNotification *)notification
Discussion

Invoked on the delegate when the NSPopoverWillShowNotification notification is sent.

This method will also be invoked on the delegate’s popover, if the method has been implemented.

Availability
  • Available in OS X v10.7 and later.
Declared In
NSPopover.h