Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 通过NSXMLParser添加缩略图_Ios_Objective C_Xml_Nsxmlparser - Fatal编程技术网

Ios 通过NSXMLParser添加缩略图

Ios 通过NSXMLParser添加缩略图,ios,objective-c,xml,nsxmlparser,Ios,Objective C,Xml,Nsxmlparser,我已经成功地将XML数据解析到我的iOS应用程序中,所以现在它显示了所有最新的博客文章,但是我需要关于如何从XML文件访问缩略图的帮助。您可以使用此链接更好地查看图像存储的位置 我猜你需要为url请求数据,然后用数据创建一个图像,但只需要一个例子来帮助我 非常感谢您能为我提供的任何帮助。基本原理很简单 NSString *imageURL = @"http://~~~~"; NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithS

我已经成功地将XML数据解析到我的iOS应用程序中,所以现在它显示了所有最新的博客文章,但是我需要关于如何从XML文件访问缩略图的帮助。您可以使用此链接更好地查看图像存储的位置

我猜你需要为url请求数据,然后用数据创建一个图像,但只需要一个例子来帮助我

非常感谢您能为我提供的任何帮助。

基本原理很简单

NSString *imageURL = @"http://~~~~";
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]];
UIImage *image = [UIImage imageWithData:data];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

但你必须关注很多与网络有关的事情。你为什么不使用?这是一个非常有用的框架。有一个类别可以处理这类事情。

要显示缩略图,我将使用UICollectionView和带有嵌入式UIImageView的自定义单元格。 实现UICollectionViewDataSource协议,并在cellForItemAtIndexPath方法中执行网络工作。这样,它只在需要时获取缩略图

AFN网络也简化了很多


下面是一个使用TableView和Flickr API的示例

显示您的尝试,并更好地解释您需要帮助的代码部分。您也应该这样做。我无法在xml标记中看到图像,但它们在数据中,您可能想从数据中提取thumb?