Сделайте метод подобным этому
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [toStartPicker dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
}
if( indexPath.section == 0 )
{
cell.textLabel.text= [nameJan objectAtIndex:indexPath.row];
cell.detailTextLabel.text= [subTitlesJan objectAtIndex:indexPath.row];
}
else
{
cell.textLabel.text= [nameFeb objectAtIndex:indexPath.row];
cell.detailTextLabel.text= [subTitlesFeb objectAtIndex:indexPath.row];
}
return cell;
}
Кроме того, убедитесь, что следующие методы выглядят следующим образом
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
if( 0 == section )
{
return [nameJan count];
}
else
{
return [nameFeb count];
}
}