Managing image loading
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