摆脱细胞文本背景框

时间:2011-11-27 22:08:46

标签: ios cocoa-touch drawing

我有这张桌子:

http://i.imgur.com/kFg09.png

如何摆脱文本背后的方框?

这是我目前的代码:

    UIColor *CellColor = [UIColor colorWithWhite:0.7 alpha:0.2];
    cell.backgroundColor = CellColor;

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    cell.textLabel.font = [UIFont systemFontOfSize:16.0];
    cell.textLabel.textAlignment = UITextAlignmentRight;
    cell.textLabel.textColor = [UIColor whiteColor];
    cell.detailTextLabel.font = [UIFont systemFontOfSize:10.0];
    cell.detailTextLabel.textColor = [UIColor whiteColor];

    cell.textLabel.text = @"Title text...";
    cell.detailTextLabel.text = @"Subtitle text...";

1 个答案:

答案 0 :(得分:3)

UILabel的默认背景颜色为白色。所以这很正常。

如果您想要透明背景,则需要使用:

cell.textLabel.backgroundColor = [ UIColor clearColor ];

同样适用于detailTextLabel