Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 979
sridvijay Avatar asked Sep 03 '11 18:09

sridvijay


1 Answers

I solved the problem!

  • First go ahead and click your .xib file.
  • Where you see the first responder box and files owner - click on the popover.
  • On the sidebar go to the attributes center
  • Change the behavior from Application-Defined to Transient and it should work!

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:

like image 145
sridvijay Avatar answered Oct 03 '22 20:10

sridvijay