I have an app which displays gif images in an ImageView.

        NSString *path = @"/some/path/to/a.gif";
        NSURL *url = [ [ NSURL alloc ] initWithScheme: @"http"  host: 
@"www.some.host"  path: path ];
        NSImage *image = [ [ NSImage alloc ] initByReferencingURL: url ];
        [ self.imageView setImage: image ];

works fine, but is sometimes slow. Also the images tend to be mostly the same, 
so I thought to save the loaded  images into my Application Support folder.

First I tried: [ NSArchiver archiveRootObject: image toFile: @"/tmp/anImage" ] 
but this archives the Url, NOT the data.

Then I tried: [ image setDelegate: self ] but the NSImageDelegate method:
- (void)image:(NSImage *)image didLoadRepresentation:(NSImageRep *)rep 
withStatus:(NSImageLoadStatus)status
does NOT get called.

So: what would be a sensible way to store my loaded pictures?

Gerriet.


_______________________________________________

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

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

Reply via email to