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?
Asked
Active
Viewed 6,270 times
14
-
Figured out how to do it. First click the Popover in Interface Builder in xCode 4, then go to the attributes section on the sidebar and change the behavior of the popover to Transient instead of the default Application-Defined. This should make it disappear! – sridvijay Sep 03 '11 at 21:31
-
3Congradulations on solving your problem, but it's much better to supply answers, even if you are answering your own question, by supplying an actual answer post. Click on the "Answer your Question" button below. Also, this question is very poorly tagged. Consider adding a tag or two that relates to the platform or language you're asking about. This will help others who have your same question find the answer you worked out! – SingleNegationElimination Sep 04 '11 at 04:53
-
Thanks, I just added another answer and added some more tags! – sridvijay Sep 04 '11 at 20:21
1 Answers
26
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:

unkulunkulu
- 11,576
- 2
- 31
- 49

sridvijay
- 1,526
- 18
- 39
-
2Also, if you select Semi-transient, your first click outside of the popover will both close the popover and register with the view below it (ie. if you click directly onto a button in another view, the popover would close and the button would be pressed.) – Matt Cooper Nov 30 '13 at 21:02