I want to make tableView with multiple section but i do not want to use dictionary i have two arrays i want that first array should be loaded in first section and second in
You are on almost right track....
Let us consider your two arrays are arrOne and arrTwo.....
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if(section == 0)
return [arrOne count];
else
return [arrTwo count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
if (indexPath.section==0) {
ObjectData *theCellData = [arrOne objectAtIndex:indexPath.row];
NSString *cellValue =theCellData.category;
NSLog(@"cellValue = %@",cellValue); //To see the value of string cellValue
cell.textLabel.text = cellValue;
return cell;
}
else {
ObjectData *theCellData = [arrTwo objectAtIndex:indexPath.row];
NSString *cellValue =theCellData.category;
cell.textLabel.text = cellValue;
return cell;
}
}