views:

214

answers:

1

hello,

i have a sectioned tableview in a detailviewcontroller where i load some data in the first section. this is my code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";


UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease];

}
 // For the Ingredients section, if necessary create a new cell and configure it with an additional label for the amount.  Give the cell a different identifier from that used for cells in other sections so that it can be dequeued separately.
if (indexPath.section == PARAMETERS_SECTION) {

    switch(indexPath.row) {

        case 0:
            cell.textLabel.text = @"Pili";
            cell.textLabel.numberOfLines = 1;
            cell.textLabel.textAlignment = UITextAlignmentLeft;
            cell.detailTextLabel.text = entity.stid;
            cell.detailTextLabel.font = [UIFont boldSystemFontOfSize:12];
            cell.detailTextLabel.numberOfLines = 2;
            break;
        case 1:
            cell.textLabel.text = @"Pele";
            cell.textLabel.numberOfLines = 1;
            cell.textLabel.textAlignment = UITextAlignmentLeft;
            cell.detailTextLabel.text = entity.arec;
            cell.detailTextLabel.font = [UIFont boldSystemFontOfSize:11];
            cell.detailTextLabel.numberOfLines = 5;
            break;
        case 2:
            cell.textLabel.text = @"Pale";
            cell.textLabel.numberOfLines = 1;
            cell.textLabel.textAlignment = UITextAlignmentLeft;
            cell.detailTextLabel.text = entity.wer;
            cell.detailTextLabel.font = [UIFont boldSystemFontOfSize:11];
            cell.detailTextLabel.numberOfLines = 3;
            break;
        case 3:
            cell.textLabel.text = @"Pole";
            cell.textLabel.numberOfLines = 1;
            cell.textLabel.textAlignment = UITextAlignmentLeft;
            cell.detailTextLabel.text = entity.groid;
            cell.detailTextLabel.font = [UIFont boldSystemFontOfSize:11];
            cell.detailTextLabel.numberOfLines = 3;
            break;
        default:
            break;
    }


    if (indexPath.section == NOTES_SECTION) {        
    NSString *text = nil;

            text = @"User Notes";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.editingAccessoryType = UITableViewCellAccessoryNone;
    cell.selectionStyle = UITableViewCellSelectionStyleBlue;
    cell.textLabel.text = text;
    }
        if (indexPath.section == EVALUATION_SECTION) {        
            NSString *text = nil;

            text = @"Evaluation";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.editingAccessoryType = UITableViewCellAccessoryNone;
            cell.selectionStyle = UITableViewCellSelectionStyleBlue;
            cell.textLabel.text = text;
        }
        if (indexPath.section == CENTERING_SECTION) {
            NSString *text = nil;
            text = @"Centering";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.editingAccessoryType = UITableViewCellAccessoryNone;
            cell.selectionStyle = UITableViewCellSelectionStyleBlue;
    cell.textLabel.text = text;
    }


}
return cell;

}

everything works ok for the first section. the rest of them seem to be "ignored" Can someone help me?

thank you!

A: 

fixed it!

thank you!

treasure