Re: Best Practices for Associating a File Extension With a File in XCode 4?
Re: Best Practices for Associating a File Extension With a File in XCode 4?
- Subject: Re: Best Practices for Associating a File Extension With a File in XCode 4?
- From: Vik Rubenfeld <email@hidden>
- Date: Sun, 04 Sep 2011 00:54:20 -0700
I'm sure I'm missing something - it's probably one of those things that when you see it, you wonder how you missed it.
writableTypesForSaveOperation: seems to be about file type, e.g. RTF, XML, etc., rather than file extensions. From the Apple docs:
> You can override this method to limit the set of writable types when the document currently contains data that is not representable in all types. For example, you can disallow saving to RTF files when the document contains an attachment and can only be saved properly to RTFD files.
The Apple docs don't seem to provide a demo app that calls this, but, from FunHouseDocument.m:
> + (NSArray *)writableTypes
> {
> return [NSArray arrayWithObjects:@"Fun House Preset", @"JPEG File", @"TIFF File", nil];
> }
Also from FunHouseDocument.m:
> + (BOOL)isNativeType:(NSString *)aType
> {
> return [[[self class] writableTypes] containsObject:aType];
> }
So I still haven't discovered how to tell NSSavePanel what file type my document should be, when calling saveDocumentWithDelegate:didSaveSelector:contextInfo.
I'm sure it's right in front of me. What am I not seeing yet?
On Sep 3, 2011, at 5:23 PM, Kyle Sluder wrote:
> On Sat, Sep 3, 2011 at 5:14 PM, Vik Rubenfeld <email@hidden> wrote:
>> If I'm using saveDocumentWithDelegate:didSaveSelector:contextInfo, what is the correct way for me to communicate the list of suitable extensions to the Save panel?
>
> NSDocument ascertains this information from calling
> -writableTypesForSaveOperation: and +isNativeType: on your NSDocument
> subclass.
>
> --Kyle Sluder
_______________________________________________
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