如何采取行动关闭 NSPopover?
您好,我在我的一个应用程序中实现了 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了问题!
一旦有人在弹出窗口外单击,这应该会使弹出窗口消失。
关闭弹出窗口的另一种方法是使用单独的按钮。
只需添加另一个
NSButton
,然后将其链接到侧边栏上的弹出窗口并将其设置为 Received actions ->执行关闭: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: