从 NSDocument 类外部保存可可文档
在我的应用程序工作流程中,有时会从笔尖初始化新的模式 NSWindow。该窗口应该有一个保存文档按钮。推荐的方法是:
- 通过新实例化的模式窗口的新 NSSavePanel 并在此处自定义整个保存流程?
- 使用从上面窗口中的按钮接收保存消息的主 NSDocument 类?如果是这样,如何保存文档?
- 还有其他场景吗?
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:
- Via a new NSSavePanel to the newly instantiated modal window and customizing the entire save flow here ?
- Using the main NSDocument class that receives save message from the button in the above window ? If so, how to save the document ?
- Any other scenario ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于那些感兴趣的人,我已经解决了这个问题,创建一个带有访问器的单例类,允许使用类似“全局”的变量,因此从新实例化的 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.