如何从 Cocoa 应用程序中显示 Finder 上下文菜单?
我的应用程序中有一个文件列表,我希望允许人们右键单击某个项目并显示与 Finder 相同的上下文菜单。这可能吗?
I have a file listing in my application and I would like to allow people to right-click on an item and show the same contextual menu as Finder does. Is this possible?
The same functionallity but for Windows Explorer is discussed in How do you show the Windows Explorer context menu from a C# application?.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法以任何稳定的方式提取 Finder 的上下文菜单,不是。您也不能告诉 Finder“在此处显示上下文菜单,就好像用户右键单击了该项目一样”。
你必须自己做。
You can't extract the Finder's contextual menu in any stable way, no. Neither can you tell the Finder “show your contextual menu here, as if the user had right-clicked on this item”.
You'll have to make your own.
如果我正确理解了问题...
现在可以通过 Finder 同步扩展在 OS X 10.10 Yosemite 中在 Finder 上下文菜单中显示自定义图标和操作:
https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Finder.html
If I understand the question correctly...
Showing a custom icon and action in your Finder Context Menu is now possible in OS X 10.10 Yosemite via a Finder Sync Extension:
https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Finder.html