是否有一个类来获取应用程序中的默认图片查看器? [英] is there a class to get the default picture viewer in an app?
本文介绍了是否有一个类来获取应用程序中的默认图片查看器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不想访问iphone上的图像,我想从我的应用程序中显示图像,但就像你在iphone的图片专辑中查看图片一样 - 包括所有的捏合和缩放控制等。
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.
这可能吗?我认为可能(偶然)会像AVMediaPlayer这样的类来做这个吗?
Is this possible? I thought there might (by chance) be some class like the AVMediaPlayer class that would do this?
谢谢
Tom
Thanks Tom
推荐答案
如果你的目标是4.0或更高版本,你可以使用 QLPreviewController :
If you're targeting 4.0 or later you can use QLPreviewController:
包括 #import<你班上的QuickLook / QuickLook.h>
以下是如何创建一个:
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;
}
这篇关于是否有一个类来获取应用程序中的默认图片查看器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文