в моем UITableViewController я определил 3 раздела.Но если я хочу получить доступ к большему количеству разделов в методе cellForRowAtIndexPath, чем в первом, это игнорируется.Например, если я хочу добавить строку во втором разделе.У кого-нибудь есть решение проблемы?
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
if (indexPath.row == 0) {
..
return cell;
}
if (indexPath.row == 1) {
..
return cell;
}
if (indexPath.row == 2) {
..
return cell;
}
}
if (indexPath.section == 1) {
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:aufgabe];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:aufgabe];
}
[cell.textLabel setText:@"Test"];
}
}
else if (indexPath.section == 2) {
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:geraet];
return cell;
}
return nil;
}