I have a document based app (multiple documents each one of them with their own core data persistent store). I'm using UIManagedDocument to develop it.
Each document is a drawing and I want to be able to save a preview (UIImage) of each drawing.
As I want to show a scrollView with all the previews I guess I shouldn't be puting the preview inside the data base, so I'm using UIManagedDocument's additional content feature as described here.
I have a couple of questions:
What use has the parameter "absoluteURL" in
additionalContentForURL:error:? It's not getting used in the example I linked.How do I retrieve the preview without opening the document? Currently I'm doing this:
.
NSString* docName = [[[DocumentStore sharedStore] documentsList]
objectAtIndex:indexPath.row];
NSString* dataDirectory = [FileUtils privateDataDirectory];
NSString *dataPath = [dataDirectory stringByAppendingPathComponent:docName];
NSString *imagePath = [dataPath
stringByAppendingPathComponent:@"AdditionalContent/thumb.png"];
UIImage * preview = [UIImage imageWithContentsOfFile:imagePath];
... but I'm not sure if this is the best way to do it.
readAdditionalContentFromURL:error:in your subclass to read data form the additional content container. developer.apple.com/library/ios/#documentation/uikit/reference/… - GregreadAdditionalContentFromURL:error:to actually read the data when the document object is instantiated. - Greg