开发者

Are NSDocument* classes only for document-based applications?

I'm wondering if NSDocument is开发者_如何学C only for applications that are text/document-based. I have an application that uses multiple windows, which together form a project. Would it be a good idea to implement those windows as NSDocuments?


NSDocument models a document, but a document doesn't need to be text-based. Typically, it is the in-memory representation of a file on disk. If your application works with files in a particular format (e.g. images or text or code or genomes or graphs...) then NSDocument will typically be the correct class to use when modelling those files.

If, however, you have windows which don't model files, NSDocument is the wrong tool to use because it is geared toward file manipulation. Instead, you would typically use one NSWindowController per window (or per closely-related set of windows) to control your UI.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜