Ios 如何通过objective-C中的图像查看器查看UIImage?

Ios 如何通过objective-C中的图像查看器查看UIImage?,ios,objective-c,uiimage,Ios,Objective C,Uiimage,我正在Objective-c中发展。我有一个WiFi媒体设备,它有许多图像文件。WiFi媒体设备将打开AP模式。因此iPhone可以通过WiFi连接 应用程序连接到WiFi媒体设备后,将读取存储在WiFi媒体设备上的所有媒体文件 我想查看WiFi媒体设备上的图像文件,但不下载。我可以获得图像文件的Url,如下所示: NSURL url=http://192.72.1.1/DCIM/100_NOML/SNAP0008.JPG 我通过以下代码将图像文件的url转换为UIImage UIImage *

我正在Objective-c中发展。我有一个WiFi媒体设备,它有许多图像文件。WiFi媒体设备将打开AP模式。因此iPhone可以通过WiFi连接

应用程序连接到WiFi媒体设备后,将读取存储在WiFi媒体设备上的所有媒体文件

我想查看WiFi媒体设备上的图像文件,但不下载。我可以获得图像文件的Url,如下所示:

NSURL url=http://192.72.1.1/DCIM/100_NOML/SNAP0008.JPG

我通过以下代码将图像文件的url转换为UIImage

UIImage *urlImage = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:url]];
UIImageView *imageView = [[UIImageView alloc] initWithImage:urlImage];
我想通过一些查看器查看UIImage

但是如何在objective-C中查看UIImage?哪个Objective-CAPI可以查看UIImage

提前感谢。

您的代码(NSURL到UIImageView)是正确的。 但我认为网址不对

如果选中代码(NSURL到UIImageView),Url将更改为

你有没有错过这个密码?
[self.view addSubview:imageView]

有一个one Apple Quick look框架,可以在任何地方查看所有类型的图像/文档,而无需将它们下载到您身边并显示出来

我已经在这里附上了苹果快速浏览框架指南的链接,希望这能对你有所帮助


以下是我要做的:

-(void)doViewImg{

    UIButton *imgViewBttn=[UIButton buttonWithType:UIButtonTypeCustom];
    CGRect frame=CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
    imgViewBttn.frame=frame;
    //your img
    UIImage *urlImage = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:url]];
    [imgViewBttn setImage:urlImage forState:UIControlStateNormal];
    imgViewBttn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentFill;
    imgViewBttn.contentVerticalAlignment = UIControlContentVerticalAlignmentFill;
    imgViewBttn.imageView.contentMode = UIViewContentModeScaleAspectFit;
    imgViewBttn.backgroundColor=[UIColor blackColor];
    [imgViewBttn addTarget:self action:@selector(closeImageViewBttn:) forControlEvents:(UIControlEvents)UIControlEventTouchDown];
    [self.view addSubview: imgViewBttn];
    [urlImage release];
}

-(void)closeImageViewBttn:(id)sender{
    UIButton *imgViewBttn=(UIButton*)sender;
    [imgViewBttn removeFromSuperview];
}

它会把UIButton放在和你的屏幕一样大的地方,然后在上面设置你的图像。触摸图像(即按钮)会将其删除。

您的意思是说您想在您的设备上查看图像:iPhone或iPad?您是否与
UIImageView
对象建立了
IBOutlet
连接?到处都有很多教程。