1.系统默认的颜色设置
//无色
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//蓝色
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
//灰色
cell.selectionStyle = UITableViewCellSelectionStyleGray;2.自定义颜色和背景设置
改变UITableViewCell选中时背景色:
UIColor *color = [[UIColor alloc]initWithRed:0.0 green:0.0 blue:0.0 alpha:1];//通过RGB来定义自己的颜色
cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]] autorelease];
还有字体颜色
cell.textLabel.highlightedTextColor = [UIColor xxxcolor];
本文介绍了如何在iOS应用中自定义UITableViewCell的颜色设置,包括系统默认的颜色选项如无色、蓝色和灰色等,同时也提供了如何通过RGB值定义自定义颜色及设置单元格选中状态背景的方法。

被折叠的 条评论
为什么被折叠?



