实现rss解析器

问题描述:

我需要开发一个带有tableview的rss解析器作为第一个视图和详细视图,因为我们在表中选择一行。实现rss解析器

但事情是,我需要根据发布日期和titleForHeaderInSection作为发布日期将表视图中的提要分组。那就是应该有很多基于日期的rss feed部分。

随着各喂有一个发布日期

我不知道生根粉在tableview中添加部分。

请帮忙。对不起,如果信息不足。

+0

你的问题不在rss解析器上,而是在表视图中? (或两者?) – 2010-10-18 07:39:03

+0

不是rss解析器。如何根据日期提供群组。并将常用日期添加为部分标题。我正在使用此链接的示例。 http://imthi.com/blog/programming/iphone-rss-reader-application-with-source-code.php – xydev 2010-10-18 07:41:47

来管理TableView中节的数目使用

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
    // Return the number of sections. 
    return noOfSections; 
} 

到计算特定部分

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
     // return no of rows in specific section 
} 

tableView:cellForRowAtIndexPath:方法的行数,同时抽取的部分和从索引路径排并用它来管理你的数据。

在组使用

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 
    // return titleForHeader; 
} 
+0

dat好...是否需要实现下面的方法? (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { – xydev 2010-10-18 08:33:07

+0

no - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)节的方法就足够了 – Gyani 2010-10-18 08:42:19

+0

ok。那么相应的行如何移动到它们各自的部分?例如。对于第一部分,可能有5个馈送形成单个部分。第二个派别可能会有另一个没有。的饲料。等等。 – xydev 2010-10-18 09:02:26

可以使阵列的词典管理标题头。关键将是日期和对象,rss项目的数组。 然后,我将字典键排序到一个数组,使日期有序。

在表视图源委托:

  • numberOfSectionsInTableView:将 日期的排序阵列, 或条目中的 字典
  • 的tableView的nomber在数:titleForHeaderInSection: 将是排序数组中的日期
  • tableView:numberOfRowsInSection:将是字典中用于排序数组项的键的rss项的数量
+0

NSSortDescriptor * sortDesc = [NSSortDescriptor sortDescriptorWithKey:@“Pub date”升序:YES]; \t \t [root sortUsingDescriptors:[NSArray arrayWithObject:sortDesc]]; \t \t [self.root sortUsingDescriptors:states];是这样吗? – xydev 2010-10-18 08:37:21