Re: NSDocumentController and multiple document types
Re: NSDocumentController and multiple document types
- Subject: Re: NSDocumentController and multiple document types
- From: Scott Anguish <email@hidden>
- Date: Tue, 5 Aug 2003 03:36:25 -0400
On Tuesday, August 5, 2003, at 3:04 AM, Francisco Tolmasky wrote:
What is the best course of action if you plan on having more than one
document type. I'll just use Project Builder as an example, you can
have "project" documents or "text" documents. Do both of these have
the same NSDocumentController? Would you still just call
[NSDocumentController open:]. How would you intercept and understand
which one to choose?
The file types are mapped to NSDocument subclasses in the project's
info.plist file (which you can edit in Targets).
So you'd have a single NSDocumentController, but multiple NSDocument
subclasses, and when you open the correct one will be created for the
appropriate file.
When you create them yourself (if you end up needing to do this -- to
make a new document of a specific type as an example) you'll use
-makeUntitledDocumentOfType: or -openUntitledDocumentOfType:display:
You could subclass NSDocumentController and override
makeUntitledDocumentOfType:/makeDocumentWithContentsOfURL:ofType: if
you needed to which type of NSDocument subclass is made for the
specific type.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.