i need to have a 61 section in UITableView, thats mean i must have 61 NSArray, right ?!
first i define 61 NSArray, and init that in view did load
it's tired to use this code
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
switch (section) {
case 0:
return [searchArray_1 count];
break;
case 1:
return [searchArray_2 count];
break;
case 2:
return [searchArray_3 count];
break;
case 3:
return [searchArray_4 count];
break;
...
case 60:
return [searchArray_61 count];
break;
}
return 1;
}
and this code in configure cells
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.myTable dequeueReusableCellWithIdentifier:CellIdentifier];
switch (indexPath.section) {
case 0:
cell.textLabel.text = [searchArray_1 objectAtIndex:indexPath.row];
break;
case 1:
cell.textLabel.text = [searchArray_2 objectAtIndex:indexPath.row];
break;
case 2:
cell.textLabel.text = [searchArray_3 objectAtIndex:indexPath.row];
break;
...
case 60:
cell.textLabel.text = [searchArray_61 objectAtIndex:indexPath.row];
break;
default:
break;
}
return cell;
}
it's working ok, but how can i reduce that arrays