I don't want to access the images on the iphone, I want to display an image from my app, but like you view pictures in the picture album of the iphone - with all the pinch and zoom controls and such.
Is this possible? I thought there might (by chance) be some class like the AVMediaPlayer class that would do this?
Thanks Tom
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;
}
来源:https://stackoverflow.com/questions/3752731/is-there-a-class-to-get-the-default-picture-viewer-in-an-app