NSPopover subclass: how to know that the popover closes?

18 Views Asked by At

I'm writing an NSPopover subclass, and I want the popover to execute some code when it closes.

However, the -close method isn't generally called when the popover closes (when the user clicks outside the popover), neither is the -peformClose: method.

I tried setting the popover as the delegate of its window, but none of the NSWindowDelegate method (-windowDidClose:, -windowDidMinimize:, -windowDidResignKey:, etc.) is called when the popover closes.

I know that -popoverDidClose: is sent to the popover delegate when it has closed (and this appears reliable), but that is a delegate method, not a method of NSPopover. And the popover should not be the delegate of itself to determine when it has closed.

Any suggestion?

0

There are 0 best solutions below