带有 RSS 的 iOS 照片查看器

标签 ios rss photo-gallery

我有一个 RSS 提要,其中包含照片的标题 en url,我想在这些图片中构建。做这个的最好方式是什么?我使用 MWPhotoBrowser 并且插入照片的方式是:

self.photos = [NSMutableArray array];
[photos addObject:[MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"photo2l" ofType:@"jpg"]]];
[photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:@"http://farm4.static.flickr.com/3629/3339128908_7aecabc34b.jpg"]]];
[photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:@"http://farm4.static.flickr.com/3590/3329114220_5fbc5bc92b.jpg"]]];

如何使用 RSS 做到这一点?

谢谢!

最佳答案

如果您想从 RSS 提要创建照片查看器,我建议查看 MWFeedParser .您可以轻松获取每个项目的标题和 url,并根据需要显示它们。

1 - 使用 MWFeedParser,解析您的提要:

//feedURL would be your Photo RSS Feed
feedParser = [[MWFeedParser alloc] initWithFeedURL:feedURL];

2 - 在 MWFeedParser 委托(delegate)方法 didParseFeedItem 中,将项目的链接添加到您的照片数组:

-(void)feedParser:(MWFeedParser *)parser didParseFeedItem:(MWFeedItem *)item{
    if (item) [photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:item.link]]];
}

现在照片数组包含了您所有的 MWPhoto,您可以对它们做任何您想做的事情!

关于带有 RSS 的 iOS 照片查看器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14964631/

相关文章:

iphone - 类似 Instagram 评论的富 TextView

ios - iPhone NSXMLParser 解析字符串并存储在 NSNumber 变量和不同的数据类型中

iOS 解析器分配断点

wordpress - 将 "details" View 添加到 NextGEN Gallery?

ios - 如何使用ImagePickerController直接显示 'Camera Roll'

java - 用相机拍照并存储在内部而不是外部存储中

ios - Swift Compact Map 返回空

ios - 段控制位置改变

javascript - 从 RSS 提要中提取 XML 元素值

ruby - RSS pubsubhubbub 实现