自定义如何从“打开最近的”菜单中打开项目NS菜单
我正在使用正在我的应用程序中处理的图像填充“打开最近的”菜单,但是当我单击列表中的某个项目时,我收到错误“应用程序 MyApp 无法打开 PNG 类型”或类似的错误。
我可以在哪里自定义代码来指定如何“打开”图像(即我的应用程序可以处理它)?
回答
感谢 Antwan 为我指明了正确的方向。 我只是在我的代表中实现了以下内容:
- (BOOL) application:(NSApplication *)sender openFiles:(NSArray *)filenames;
I'm populating the "Open Recent" menu with images as they are being processed in my app but when I click on an item from the list I get an error "The application MyApp cannot open PNG types" or something similar.
Where can I customize the code to specify how to "open" an image in the sense that my app can process it?
ANSWER
Thanks to Antwan for pointing me in the right direction.
I simply implemented the following in my delegate:
- (BOOL) application:(NSApplication *)sender openFiles:(NSArray *)filenames;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的 NSApplicationDelegate 类需要响应文件的打开,并且为了使 macOS 识别你的应用程序能够打开此类应用程序,你需要修改你的 info.plist
your NSApplicationDelegate class needs to respond to opening of files and in order to make mac os x recognize your application being able to open such applications you need to modify your info.plist