对于仅作为文件查看器的应用程序,我是否需要在子类中重写 NSDocument 的写入方法

发布于 2024-08-26 23:43:38 字数 359 浏览 3 评论 0原文

我想我可能错过了显而易见的事情,但我不确定。

有关 NSDocument 子类化的部分文档指出 NSDocument 的子类必须重写一种读取方法和一种写入方法。

如果我正在创建一个不会写回任何内容的查看器应用程序,我是否仍然需要重写写入方法(返回什么,nil?)或者我可以忽略它并确保没有保存可以被调用的方法?

I think I may be missing the obvious but I'm not sure.

The section on subclassing NSDocument in the docs states that subclasses of NSDocument must override one reading and one writing method.

If I'm creating a viewer application that will not write anything back, do I still need to override a writing method (returning what, nil?) or can I ignore it and make sure that there are no saving methods that can get called?

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

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

发布评论

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

评论(1

鹿! 2024-09-02 23:43:38

鉴于文档说“必须”,我会说是的,编写一个不执行任何操作的写入方法。即使它现在不需要它也能工作,而且没有明显的理由打破这一点,如果它说“必须”,那么 AppKit 在未来的某个时候真正需要它是完全公平的。

Given that the documentation says “must”, I’d say yes, write a do-nothing write method. Even if it works without one now, and there’s no obvious reason to break that, if it says “must” it’s entirely fair for AppKit to actually require it at some point in future.

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