2010-11-15 138 views
0

我试图改变使用下面的代码的单元格的颜色变化uifont颜色,但它显示了细胞的全为白色字体代替金RGB颜色代码,我有。表格单元格

if (row == 0) 

    [email protected]"An blah blah"; 
    cell.textLabel.textColor = [UIColor colorWithRed:139 green:136 blue:120 alpha:1]; 

回答

4

你设定了错误的标签,这应该工作:

[email protected]"An blah blah"; 
cell.detailTextLabel.textColor = [UIColor colorWithRed:139/255.0f green:136/255.0f blue:120/255.0f alpha:1]; 
+0

感谢我有正确的标签在我的应用程序,我只是改写了他们错在这里抱歉,但感谢为师255提示 – 2010-11-15 19:24:20

1

的RGB参数的范围是0到1
由255把你的0-255值。

if (row == 0) 
    [email protected]"An blah blah"; 
    cell.textLabel.textColor = [UIColor colorWithRed:139/255.0f green:136/255.0f blue:120/255.0f alpha:1]; 

此外,也许你的意思是detailTextLabel.textColor而不是textLabel.textColor。

0

我不知道你这样做,如果该实例的缘故,而是你应该使用

if (indexPath.row == 0){ 
    [email protected]"detailed text"; 
    cell.textLabel.textColor = [UIColor colorWithRed:139/255.0f green:136/255.0f blue:120/255.0f alpha:1]; 
    return; 
}