UITableView字幕没有出现

fla*_*ghi 4 objective-c uitableview ios

我有这个简单的代码:

- (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;
}
Run Code Online (Sandbox Code Playgroud)

问题是我的副标题没有出现.我做错了什么.请帮忙.谢谢.

Nic*_*ver 23

您必须选择其他单元格样式,请查看文档:

UITableViewCellStyleDefault

具有文本标签(黑色和左对齐)和可选图像视图的单元格的简单样式.请注意,这是iOS 3.0之前的单元格的默认样式.

我想,你想要的是:

UITableViewCellStyleSubtitle

单元格的样式,顶部带有左对齐标签,下面带有左对齐标签,带有较小的灰色文本.iPod应用程序使用这种风格的单元格.

您可以参考iOS视图编程指南章节表视图样式和附件视图,查看样式的概述及其外观.