Hey guys i've got an problem and don't know how to handle it.
if i make a section the error occurs.
Heres my code it would be so nice if somewone can help me :)
I've already tried to set the section index to 0 and 1 but that didn't help either.
Thanks in advance
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
static NSString *CellIdentifier1 = @"Cell1";
if(indexPath.section == 1) {
if(indexPath.row == 0) {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.text = @"test 1";
}
return cell;
}
else if(indexPath.row == 1) {
UITableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (cell1 == nil) {
cell1 = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
cell1.text = @"test 2";
}
return cell1;
}
}
else if(indexPath.section == 2) { if(indexPath.row == 0) {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.text = @"test 1";
}
return cell;
}
else if(indexPath.row == 1) {
UITableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; if (cell1 == nil) { cell1 = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; cell1.text = @"test 2";
}
return cell1;
}
} }