Overriding [NSDocument saveDocumentTo]
Overriding [NSDocument saveDocumentTo]
- Subject: Overriding [NSDocument saveDocumentTo]
- From: Ken Tabb <email@hidden>
- Date: Wed, 1 Aug 2001 09:51:09 +0100
Hi,
following up from a previous message a couple of days ago, I'm trying to
add the ability to export TIFF stills from a QuickTime movie.
I was previously (erroneously, but it made it easy 8^) overriding
[myDocument dataRepresentationOfType:] to return the TIFF representation
of the pic, thus:
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
return [[myImageView image]TIFFRepresentation];
}
but after some kind soul pointed out the obvious to me (for which I thank
them), I need to be overriding [NSDocument saveDocumentTo:] if I want
export features. My question is, looking at the NSDocument class, it
doesn't say anything about this method in the general discussion section,
and in the method description, it doesn't explain what the return value
or parameter are for. This is also true for the related methods save: and
saveDocumentAs:. For instance in dataRepresentationOfType: all I have to
do is return the TIFF to get it to write it to file. But [NSDocument
saveDocumentTo:] instead takes an id and returns an IBAction...
- (IBAction)saveDocumentTo:(id)sender
I have 3 questions:
[1] as I am able to get the TIFF without needing to delve too deeply, I
assume I can just ignore the 'sender'?
[2] How do I get it to write the file (from the TIFF)? In
dataRepresentationOfType: it was easy, but this doesn't look so easy.
[3] What IBAction am I meant to return?
Maybe I'm not thinking straight here!
Thanks for waking me up,
Ken
---------
Ken Tabb.
Mac & UNIX C/C++/Java developer (Health & Human Sciences),
Machine Vision researcher/programmer (Computer Science),
University of Hertfordshire, England
http://www.health.herts.ac.uk/ken/
Certified non-Microsoft Solution Provider