当我们在表格中选择一行时,我需要开发一个带有tableview的rss解析器作为第一个视图和详细视图。
但问题是,我需要根据发布日期和titleForHeaderInSection将表格视图中的Feed分组为发布日期。也就是说,根据日期应该有许多RSS部分。
每个Feed都有一个发布日期
我不知道在tableview中添加部分。
请帮忙。对不起,如果信息不充分。
答案 0 :(得分:1)
管理TableView中的Sections数量
- (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;
}
答案 1 :(得分:0)
您可以制作数组字典。键是日期,对象是rss项的数组。 然后我将字典键排序到一个数组,以便订购日期。
在表视图源委托中: