PDA

View Full Version : RSS Feed Almost there...




nashyo
Mar 8, 2012, 04:55 PM
I've written some code that presents a UITableView with the following rss feed @"http://www.bristol.ac.uk/news/news-feed.rss".

I currently parse the file using NSXMLParser, successfully, and generate an NSDictionary containing the link for each feed.

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
//NSLog(@"ended element: %@", elementName);
if ([elementName isEqualToString:@"item"]) {
// save values to an item, then store that item into the array...
[item setObject:currentTitle forKey:@"title"];
[item setObject:currentLink forKey:@"link"];
[item setObject:currentSummary forKey:@"summary"];
[item setObject:currentDate forKey:@"date"];

[stories addObject:[item copy]];
NSLog(@"adding story: %@", currentTitle);
}

}

However, how can I generate a View layout thet summarises the feed, similar to how mail does it with feeds (in following image) ? I like the 'read more' button too.

I assume I just pass an object from the dictionary over to a new view on the stack, once a feed is selected.

http://i44.tinypic.com/313n2xj.png



seepel
Mar 10, 2012, 11:13 PM
I think your best bet is to display the content in a UIWebView as a lot of RSS feeds spit out HTML anyway. Then for the header and read more link you can inject your own HTML code sandwiching the content.

MattInOz
Mar 11, 2012, 06:49 PM
To me it's looks like each item or sticky note graphic is a custom UITableViewCell subclass. Likely one that receives one of your item objects and assigns text of the attributes of that object to various UILabels laid out within that cell.