Reputation: 33430
What is the simplest way to persistently store a NSCache
filled with NSImage
s? I'm not looking for Core Data, which seems like overkill for just storing a dictionary with images.
Upvotes: 2
Views: 551
Reputation: 3733
If all you have is a set of pictures, I'd simply get a path from the user and use NSImage's TIFFRepresentation
to get instances of NSData for each picture, which can then be written to the path using NSFileManager and NSFileHandle.
If you have info accompanying the images, like tags, I'd put that, along with identifying titles for the images, in an array of dictionaries. Then you can use NSArray's writeToFile:atomically:
method to write out a plist.
Upvotes: 1