UITableViewCell textLabel颜色不变

我有一个UITableView和cellForRowAtIndexPath方法,我正在改变单元格的一些属性(字体,大小等)现在所有的任务下面列出的工作就好了,除了改变textLabel的颜色。 我不明白为什么只有那个特定的颜色属性不会改变。 我到处都可以想到,为什么它不工作,我卡住了。 有任何想法吗?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *kLocationAttributeCellID = @"bAttributeCellID"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kLocationAttributeCellID]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:kLocationAttributeCellID] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleBlue; cell.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0]; cell.detailTextLabel.numberOfLines = 0; cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap; cell.userInteractionEnabled = NO; cell.textLabel.font = [UIFont fontWithName:@"Courier" size:18.0]; cell.textLabel.textColor = [UIColor redColor]; // this never takes effect... } cell.textLabel.text = @"Test Label"; cell.detailTextLabel.text = @"Test Details"; return cell; } 

正因为如此:

 cell.userInteractionEnabled = NO; 

如果你不希望你的单元格可以select,请尝试使用它来代替:

 cell.selectionStyle = UITableViewCellSelectionStyleNone;