Ios5 字幕字符串不显示在单元格中

Ios5 字幕字符串不显示在单元格中,ios5,xcode4.2,Ios5,Xcode4.2,此代码编译良好,没有警告,但子字符串不显示在单元格中。知道为什么吗 TableExampleViewController.m #import "TableExampleViewController.h" @implementation TableExampleViewController @synthesize colorNames; - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; //

此代码编译良好,没有警告,但子字符串不显示在单元格中。知道为什么吗

TableExampleViewController.m

#import "TableExampleViewController.h"

@implementation TableExampleViewController

@synthesize colorNames;

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

 - (void)viewDidLoad
{
    [super viewDidLoad];
    self.colorNames = [[NSArray alloc] initWithObjects:@"Red", @"Green", @"Blue",     @"Indigo", @"Violet", nil];
}

 // Customize the number of rows in the table view
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section     {
     return [self.colorNames count];
}

// Customize the appearance of table view cells
- (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];
}

     // Configure the cell
    UIImage *cellImage = [UIImage imageNamed:@"apple.png"];
                      cell.imageView.image = cellImage;
    NSString *colorString = [self.colorNames
                       objectAtIndex:[indexPath row]];

    cell.textLabel.text = colorString;
    NSString *subtitle = [NSString stringWithString:@"All about the color "];
    subtitle = [subtitle stringByAppendingString:colorString];
    cell.detailTextLabel.text = subtitle;

    return cell;
}
更改:

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
致:

默认样式没有
detailTextLabel

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];