Cell.detailTextLabel.text - NULL

I don't understand why mine cell.detailTextLabel.textis null.

static NSString *CellIdentifier = @"Cell";
//UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyId];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    /*[[NSBundle mainBundle] loadNibNamed:@"CellTest2" owner:self options:nil];
    cell = mealPlanCell;*/
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    //self.mealPlanCell = nil;
}

cell.detailTextLabel.text = @"Test";

This will allow me to set the cell.textLabel.textvalue, but not verbose.

+1
source share
3 answers

I figured out the reason if you leave

if(cell == nil){...}

around the cell = [[[UITableViewCell alloc] ...

, , / , , if(), , , , , , "", , , , , . , , , , , , .

+1

If your rowHeight is not tall enough, cell.detailTextLabel.text will not be visible even if cell.textLabel.text is displayed. The string High of 22 seems minimal with the default font.

0
source

All Articles