Re: document types with NSDocument framework
Re: document types with NSDocument framework
- Subject: Re: document types with NSDocument framework
- From: "Simson Garfinkel" <email@hidden>
- Date: Fri, 23 Nov 2001 22:25:02 -0500
I think that I have an answer to my own question, but I still don't have a
*good* answer
If you subclass MyDocument, and you do a saveDocument: without a filename,
the following methods will be called in this order"
- (void)runModalSavePanelForSaveOperation:(NSSaveOperationType)saveOperation
delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void
*)contextInfo
- (BOOL)prepareSavePanel:(NSSavePanel *)savePanel
- (void)saveToFile:(NSString *)fileName
saveOperation:(NSSaveOperationType)saveOperation
delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector
contextInfo:(void *)contextInfo
- (NSString *)fileTypeFromLastRunSavePanel
So here is what you do:
1. Subclass prepareSavePanel:(NSSavePanel *)savePanel so that your aux view
is inserted into the SavePanel.
2. Subclass fileTypeFromLastRunSavePanel to return the file type that the
user choose.
3. Make sure that - (NSData *)dataRepresentationOfType:(NSString *)aType
handles the type.
I'd still like to see how this is done automatically, the way that the
Sketch application obviously does.
Anybody have any clues?