在iOS中获取来自RSS源的图像
问题描述:
我正在获取RSS源中项目的标题,日期和链接。我想将每个项目的图像添加到我的tableview单元格中,我知道该怎么做。我遇到的问题是搞清楚如何获取图像的URL。在iOS中获取来自RSS源的图像
与图像的URL的XML看起来是这样的:
<description><img src="http://images.cdn.bigcartel.com/bigcartel/product_images/128552379/max_h-300+max_w-300/LipsITUNES.jpg" title="The Lips- Album Numero Dos" align="left" style="margin:0 10px 10px 0;" />
Picking up where the previous album left off (self-titled, don't go looking for "Album Numero Uno") The Lips return with 12 new songs and their unique blend of indie garage rock.
Includes the single "Useless" and "My Name Is Suicide."</description>
这也是有:
<media:thumbnail height="75" url="http://images.cdn.bigcartel.com/bigcartel/product_images/128552379/max_h-75+max_w-75/LipsITUNES.jpg" width="75"/>
<media:description type="html">
答
使用didStartElement
委托方法。
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{
if (nil != qualifiedName)
{
elementName = qualifiedName;
}
if ([elementName isEqualToString:@"media:thumbnail"])
{
self.currentItem.mediaUrl = [attributeDict valueForKey:@"url"];
}
}
乌尔目前执行检查呢? –