If you're targeting 4.0 or later you can use QLPreviewController:
Include #import <QuickLook/QuickLook.h>
in your class
Here is how to create one:
Class qlookclass = NSClassFromString(@"QLPreviewController");
if(qlookclass){
//check if the image exists
if([[NSFileManager defaultManager] fileExistsAtPath:@"someimage.png"]){
id quickLookPreview = [[qlookclass alloc]init];
[quickLookPreview setDataSource:self];
[self presentModalViewController:quickLookPreview animated:YES];
[quickLookPreview release];
}
}
Then somewhere else in your view controller:
#pragma mark QLPreviewController delegate methods
- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller {
return 1;
}
- (id <QLPreviewItem>) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index {
NSURL *imageURL = [NSURL fileURLWithPath:@"someimage.png"];
return imageURL;
}