从 NSDocument 类外部保存可可文档

发布于 2024-11-19 09:51:38 字数 201 浏览 8 评论 0原文

在我的应用程序工作流程中,有时会从笔尖初始化新的模式 NSWindow。该窗口应该有一个保存文档按钮。推荐的方法是:

  1. 通过新实例化的模式窗口的新 NSSavePanel 并在此处自定义整个保存流程?
  2. 使用从上面窗口中的按钮接收保存消息的主 NSDocument 类?如果是这样,如何保存文档?
  3. 还有其他场景吗?

During my app workflow there is a moment when a new modal NSWindow is initialized from a nib. This window should have a save document button. Which is the recommended approach:

  1. Via a new NSSavePanel to the newly instantiated modal window and customizing the entire save flow here ?
  2. Using the main NSDocument class that receives save message from the button in the above window ? If so, how to save the document ?
  3. Any other scenario ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我也只是我 2024-11-26 09:51:38

对于那些感兴趣的人,我已经解决了这个问题,创建一个带有访问器的单例类,允许使用类似“全局”的变量,因此从新实例化的 NSWindowController 调用方法和发送消息现在变得轻而易举。 Todo:研究一下使用 KVC 的可能性。

For those interested, I have solved this creating a singleton class with accesors that allows using "global"-like variables, thus calling methods and sending messages from the newly instantiated NSWindowController is now a breeze. Todo: look into possible using KVC for this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文