当扩展坞保持活动状态时隐藏 NSMenu
我希望我的应用程序仅在用户未打开文件时才在启动时显示他的菜单。现在我似乎无法让它发挥作用。隐藏菜单会使停靠栏和状态栏不可见。我希望它们仍然在那里,但不是我自己的菜单(例如,如果您从查找器打开文件,查找器菜单仍然可见,但我的应用程序打开一个处理文件的窗口,如果用户取消或打开,则退出完成)。
I want my app to show his menu on launch only if the user didn't open a file. Now I can't seem to make it work. Hiding the menu makes the dock and the status bar invisible. I want them to still be there, but not with my own menu (e.g. if you open a file from finder, the finder menu is still visible, but my app opens a window that handles the file, and quits if the user cancels or on completion).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能解释得不够好,但这是我解决它的方法:
将此行添加到我的应用程序的 plist 中(这会生成一个没有停靠图标或菜单的应用程序),停靠栏和菜单栏将仍然在那里,但不会被应用程序更改:
LSUI元素
(并将复选框设置为true)。
这使得你的应用程序仅包含 UI(它不显示他的 NSMenu,也不向 Dock 添加图标,而只是显示你的 GUI。
I probably didn't explain it well enough, but here's what I did to solve it :
Add this line to the plist of my app (this produces an app without dock icon or menu), the dock and the menu bar will still be there, but won't be changed by the app :
LSUIElement
(And set the checkbox to true).
This makes your app UI-only (it doesn't show his NSMenu nor does it add an icon to the dock, but just shows your GUI.