我有一个表,其中有很多部分和数据要在所有部分显示在一个数组resultArray中,那么当我们有两个部分时如何正常显示截面数据然后我们为每个部分创建两个数组,但是这里是多个部分如何解决这个问题。
由于
我的结果数组是
NSArray *tempArray =[[DataController staticVersion] startParsing:@"http://www.celeritas-solutions.com/pah_brd_v1/productivo/catalogMaster.php"];
for (int i = 0; i<[tempArray count]; i++) {
id *item = [tempArray objectAtIndex:i];
NSDictionary *dict = (NSDictionary *) item;
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];
[theObject release];
theObject=nil;
}
表格中的部分编号属于数组
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [categoryArray count] ;
}
部分标题
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return [categoryArray objectAtIndex:section];
}