如何使操作关闭NSPopover? [英] How to make action to close NSPopover?
问题描述
您在我的一个应用程序中实现了NSPopover,但popover不会关闭。我猜,它应该关闭一旦我点击别的东西,但它不是。我知道有一个紧密的popover动作,但只适用于一个不同的按钮。我如何让它看起来看到弹出窗口是打开的,当它打开以关闭popover当我按下同一按钮?
我解决了问题!
- 首先点击您的.xib文件。
- 在侧边栏上,转到属性中心
- 更改从应用程序定义到瞬态的行为应该可以工作!
<
这样,一旦有人在弹出框外单击,弹出框就会消失。 / p>
另一种关闭popover的方法是有一个单独的按钮。
只需添加另一个 NSButton
,然后将其链接到侧边栏上的弹出框,并将其设置为接收操作 - >执行关闭:
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:
这篇关于如何使操作关闭NSPopover?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!