UITableView Subtitle Not Displaying

I have this simple code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton; } // Configure the cell... NSString *subtitle = [NSString stringWithString: @"All about the color "]; cell.detailTextLabel.text=subtitle; cell.textLabel.text = [authorList objectAtIndex: [indexPath row]]; return cell; } 

The problem is that my subtitles are not displayed. What am I doing wrong. Please, help. Thanks.

+4
source share
1 answer

You will need to select a different cell style, see the documentation:

UITableViewCellStyleDefault

A simple style for a cell with a text label (black and left) and additional viewing of the image. Please note that this is the default style for cells prior to iOS 3.0.

I think you want:

UITableViewCellStyleSubtitle

The style for the cell with the label aligned to the left on top and on the left is the inscription below in smaller gray text. The iPod app uses cells in this style.

You can refer to the table programming guide for the iOS chapter Table and Accessory Styles to view an overview of the styles and what they look like.

+23
source

All Articles