Re: Handling Multiple Document Types
Re: Handling Multiple Document Types
- Subject: Re: Handling Multiple Document Types
- From: "Blain Hamon" <email@hidden>
- Date: Sun, 8 Jul 2007 21:05:55 -0700
I have a NSDocument application which should handle two types of
document.
One document will be an actual file and the other will not.
How related are the documents? You can have multiple file types, each
with their own NSDocument class, if you play with the info.plist. My
own multi-document setup is the native file class is first in line,
then a catch-all file class that instead of reading a file, sends it
to an already open object through the app delegate. That way, it
tries to read it natively first, and then falls back to the catch-all.
But if they're completely separate, you might just want two
NSDocument subclasses instead. And let Cocoa decide which one to use
based on info.plist. Actually, even if they're related, you could
have a common NSDocument subclass that both DocumentA and DocumentB
subclass.
If they're identical in interface/nib, and you really want to keep to
one NSDocument, I suppose you could move the differing code to a
delegate, and create/retain the appropriate delegate object on
loadUrl. With an id for the delegate, you don't even need to have the
delegate objects be related, just as long as they respond to the
right messages. Hope this helps.
--Blain.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden