cocoapopoverappkitnspopoveruibuilder

How to make action to close NSPopover?


Hi I implemented an NSPopover in one of my apps, but the popover will not close. I'm guessing that it should close once I click something else, but its not. I know that there's a close popover action but that only works for a different button. How can I make it look to see that the popover is open and when it is open to close the popover when I press the same button?


Solution

  • I solved the problem!

    That should make the popover disappear once someone has clicked outside the popover.

    Another way to close the popover is to have a separate button. Just add another NSButton and then link it to the popover on the sidebar and set it to Received actions -> perform close: