how to cache images
how to cache images
- Subject: how to cache images
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 08 Jun 2013 16:25:01 +0700
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 (email@hidden)
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:
This email sent to email@hidden