Hi list,

I'd like to be able to use an NSImageView to display a default animated GIF image. The image may be replaced by the user.

I have been using the code below to save / load images from / into the image view. I would like to know how, if it is possible, one saves an animated gif, preserving the animation.

Also, the animation is lost when the program saves then reloads the image - is it possible to save (using aCoder) with animation preserved?

Thanks!

To save image to file:

   if([lbLoading image] != nil){
NSData * tiffData = [[lbLoading image] TIFFRepresentation]; NSBitmapImageRep *bits = [NSBitmapImageRep imageRepWithData:tiffData]; // get a rep from your image, or grab from a view
           NSData *data;
           [bits is]
NSString *fullPath = [NSString stringWithFormat:@"%@/[EMAIL PROTECTED]@.gif",path,@"loading",[self uniqueID]]; data = [bits representationUsingType: NSGIFFileType properties: nil];
           [data writeToFile: fullPath atomically: NO];
           [files addObject:fullPath];
       }


When the program saves its data:

   [aCoder encodeObject:[lbLoading image] forKey:@"lbLoading"];


And at load:

   [lbLoading setImage:[aDecoder decodeObjectForKey:@"lbLoading"]];

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to