开发者

Do I need to override the writing methods of NSDocument in subclasses for an application that will only be a viewer for files

开发者 https://www.devze.com 2022-12-24 16:27 出处:网络
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 开发者_JS百科override one reading and one writing m

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 开发者_JS百科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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消