开发者

Looking to introduce tabs to document-based application, ideas?

I have a document based application, that so far simply edits documents with a new window for each document.

I'm now adding the ability to create a project, which is a document in itself. That project will contain a list of files that can be edited using (hopefully) the same code as my existing NSDocument subclass, with the exception that the document editor will be embedded into开发者_Python百科 the project window, not opened in a new window.

How does Xcode, for example, open each file in the editor pane, without using a new window per document? I assume it uses the document-based architecture since it behaves much like any other document-based application with the exception of the single window thing.

Since an NSDocument must (according to the documentation) have it's own window controller, is it possible to "embed" that window inside another window (i.e. inside my project window), making the chrome invisible to give the effect of a single window?

EDIT: This discussion on CocoaDev looks really useful: Document Based App With One Window For All Documents


Obviously this is a long standing questions but because I recently was (and still am) in the same situation and couldn't find any useful solutions to the issue I started a testbed project myself and hosted it on Github: https://github.com/lemonmojo/NSDocumentSingleWindowTest

It's still a work in progress but the most important bits are there, waiting to be improved. You should be able to extract just the code you require for your project pretty easily.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜