[exact same post, with "file type" changed to "file extension" in 2nd to last 
paragraph]

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 extension 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 <v...@mindspring.com> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to