Implement rss parser
I need to develop an rss parser with a t开发者_运维问答ableview as the first view and detail view as we select a row in table.
But the thing is, i need to group the feeds in table view based on publishing date and titleForHeaderInSection as the publishing date. That is there should be many sections of rss feed based on date.
With each feed there is a publishing date
I have no idea abt adding sections in tableview.
Please help. Sorry if the information is not sufficient.
to manage number of Sections in TableView use
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return noOfSections;
}
to calculates the number of rows in a specific section
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// return no of rows in specific section
}
in tableView:cellForRowAtIndexPath:
method, extract both the section and row from the index path and use that to manage your data.
for managing title For Header in Section use
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
// return titleForHeader;
}
You can make a dictionary of array. The key will be the dates, and the object, an array of rss item. Then I will sort the dictionary key to an array to have the date ordered.
In the table view source delegate:
- numberOfSectionsInTableView: will be the number of date in the sort array, or the nomber of entry in the dictionary
- tableView:titleForHeaderInSection: will be the date in the sort array
- tableView:numberOfRowsInSection: will be the number of rss item in the dictionary for the key of the sort array item
精彩评论