Hi again -
In my custom OUIDocument subclass I override writePreviews with the following implementation:
1) create my images. both landscape and portrait
2) cache them like this:
3) actually write out the previous to disk like this:
Seems to work but is this the proper way of implementing this method?
Thanks in advance
In my custom OUIDocument subclass I override writePreviews with the following implementation:
1) create my images. both landscape and portrait
2) cache them like this:
Code:
[OUIDocumentPreview cachePreviewImages:^(OUIDocumentPreviewCacheImage cacheImage){ cacheImage(landscapeImage, [OUIDocumentPreview fileURLForPreviewOfFileURL:fileURL date:date withLandscape:YES]); cacheImage(portraitImage, [OUIDocumentPreview fileURLForPreviewOfFileURL:fileURL date:date withLandscape:NO]); }];
Code:
NSData *imageData = UIImageJPEGRepresentation([UIImage imageWithCGImage:landscapeImage], 1.0); [imageData writeToURL:[OUIDocumentPreview fileURLForPreviewOfFileURL:fileURL date:date withLandscape:YES] options:0 error:outError]; imageData = UIImageJPEGRepresentation([UIImage imageWithCGImage:portraitImage], 1.0); [imageData writeToURL:[OUIDocumentPreview fileURLForPreviewOfFileURL:fileURL date:date withLandscape:NO] options:0 error:outError];
Thanks in advance