我有tableView,我从数组中获取数据,也从数组中获取部分和部分标题的数量,但是当我从数组中给出部分标题时,它会破坏应用程序。
获取数组中的值:
NSArray *tempArray =[[DataController staticVersion] startParsing:@"http://www.celeritas-solutions.com/pah_brd_v1/productivo/getCategory.php"];
for (int i = 0; i<[tempArray count]; i++) {
id *item = [tempArray objectAtIndex:i];
NSDictionary *dict = (NSDictionary *) item;
ObjectData *theObject =[[ObjectData alloc] init];
[theObject setCategoryID:[dict objectForKey:@"CategoryID"]];
[theObject setCategoryTitle:[dict objectForKey:@"CategoryTitle"]];
[theObject setCategoryDescription:[dict objectForKey:@"CategoryDescription"]];
[theObject setCategoryAddedByUserID:[dict objectForKey:@"CategoryAddedByUserID"]];
[theObject setCategoryAddedDateTime:[dict objectForKey:@"CategoryAddedDateTime"]];
[categoryArray addObject:theObject];
[theObject release];
theObject=nil;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [categoryArray count] ;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
[categoryArray objectAtIndex:section];
}