• 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
Managing image loading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Managing image loading


  • Subject: Managing image loading
  • From: Leonardo <email@hidden>
  • Date: Tue, 04 Feb 2014 12:05:33 +0100
  • Thread-topic: Managing image loading

My app displays several images on several pages.
Since the app displays one page per time, I would like to optimize the
memory management at loading and displaying the images.
I thought to save my document as filePackage, put the image files within the
package and use the lazy

    image = [[NSImage alloc] initByReferencingFile:path];

to reference all the images when opening a document. So, I thought, the
images get really loaded and displayed at the time I select a given page,
and discarded (in the cache) when I change page. Does it really work that
way?

Second question. In case the user imports a new image, I presume I should
immediately copy the image file within the filePackage then call
initByReferencingFile. Should I use

    imgFileWrap = [[NSFileWrapper alloc] initWithURL:url options:
NSFileWrapperReadingWithoutMapping error:&err];
    [documentFileWrapper addFileWrapper: imgFileWrap];

 or should I simply copy the file image within the filePackage with the
following?

    [[NSFileManager defaultManager] copyItemAtPath:src toPath:dst
error:nil];


Regards
-- Leonardo


_______________________________________________

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: Managing image loading
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Delays in awaking iOS app
  • Next by Date: Re: How to display NSStrokeColorAttributeName on the NSColorPanel
  • Previous by thread: Re: Animation on gesturing
  • Next by thread: Re: Managing image loading
  • Index(es):
    • Date
    • Thread