Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 NSMenu 当用户单击状态栏中的 NSStatusItem 时打开。如何确定 NSMenu 是否打开(扩展)?
谢谢!
您可以使用NSMenuDelegate协议来处理menuWillOpen和menuWillClose消息。用于menuWillOpen设置表示菜单已打开的布尔值,并将menuWillClose其关闭。
NSMenuDelegate
menuWillOpen
menuWillClose
更新:看起来menuWillClose:不再是可用的委托方法。改为使用menuDidClose:。
menuWillClose:
menuDidClose: