• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
how to cache images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: how to cache images
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Page Based Application Template in Xcode
  • Next by Date: CALayer -displayLayer:inContext: never called during frame/bounds animation
  • Previous by thread: Page Based Application Template in Xcode
  • Next by thread: Re: how to cache images
  • Index(es):
    • Date
    • Thread