开发者

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?


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:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜