I have a table view with an image cell… but the images are not within the main application bundle. If the images were in the bundle, then I could simply use this code to reference the image:
set theValue to NSImage's imageNamed_("green")
(above taken from Craig’s booklist example)
Since the images are not within the bundle, I’m using the following code:
set newImage to NSImage's alloc()'s initWithContentsOfFile_(posixPathOfImage)
newImage's setName_(theImageNameWithoutPathOrExtension)
set theValue to NSImage's imageNamed_(theImageNameWithoutPathOrExtension)
The above actually works… but only for a few seconds or minutes. So, I assume that this object is being released from memory. My question is: Once I use setName, how do I get it to be retained? It seemed like it would be more efficient to use the setName and access the image file just once… but maybe I’m wrong about that, and need to access the image file each time? Thanks in advance for any help!