Detail Text View of Cell not showing?
Hi I started writing a split view app for iPad using the split-view template. In the root view controller (the table view on the left) I am trying to set the detail te开发者_运维技巧xt label of the cells like this:
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];
However when I run the app only the main text label (the label on the left of the cell). There is nothing that shows up in the detail label.
What am I doing wrong?
make sure that your cell is created as UITableViewCellStyleSubtitle
In cellForRowAtIndexPath method
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = @"Heading";
cell.detailTextLabel.text = @"DetailValue";
return cell;
Options :
UITableViewCellStyleValue1, // like in Settings App )
UITableViewCellStyleValue2, // Contacts style
UITableViewCellStyleSubtitle // DetailText in Grey.
精彩评论