【发布时间】:2013-03-15 21:31:34
【问题描述】:
很抱歉再次询问完整描述的问题。我有结果数组,其中包含从服务器获取的标题描述等,但问题是我想分段显示这些数据。
假设如果有三个部分来自数组,那么如何使用单个 resultArray 填充每个部分中的数据。
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return [categoryArray objectAtIndex:section];
}
resutArray 包含所有部分的所有数据,因此如何根据部分显示
数组的结构是
ObjectData *theObject =[[ObjectData alloc] init];
[theObject setCategory:[dict objectForKey:@"category"]];
[theObject setSub_Category:[dict objectForKey:@"sub_Category"]];
[theObject setContent_Type:[dict objectForKey:@"content_Type"]];
[theObject setContent_Title:[dict objectForKey:@"content_Title"]];
[theObject setPublisher:[dict objectForKey:@"publisher"]];
[theObject setContent_Description:[dict objectForKey:@"content_Description"]];
[theObject setContent_ID:[dict objectForKey:@"content_ID"]];
[theObject setContent_Source:[dict objectForKey:@"content_Source"]];
[resultArray addObject:theObject];
【问题讨论】:
-
请您展示一下您的数组的结构,您在其中存储了哪些数据。以及要在部分中显示的项目。
-
@DipenPanchasara 我已经添加了数组的结构
-
显示你的代码然后很容易解决..谢谢
-
你可以计算一行对象的数量,然后从下一个开始。这有那么难吗?
-
@AnoopVaidya 我不明白你能解释更多
标签: iphone ipad nsmutablearray uitableview