1

写真の URL というタイトルの RSS フィードがあり、その写真を組み込みたいと考えています。これを行う最善の方法は何ですか?私は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でこれを行う方法は?

ありがとう!

4

1 に答える 1

1

RSS フィードからフォト ビューアーを作成する場合は、MWFeedParserを調べることをお勧めします。各アイテムのタイトルと URL を簡単に取得して、好きなように表示できます。

1 - MWFeedParser を使用して、フィードを解析します。

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

2 - MWFeedParser デリゲート メソッド didParseFeedItem で、アイテムのリンクを写真配列に追加します。

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

photos 配列にすべての MWPhoto が含まれているので、好きなことをしてください。

于 2013-02-19T18:26:51.840 に答える