我目前正在获取RSS Feed中项目的标题,日期和链接。我想将每个项目的图像添加到我的tableview单元格,我知道如何做到这一点。我遇到的问题是弄清楚如何获取图像的网址。
带有图片网址的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">
答案 0 :(得分:4)
使用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"];
}
}