Iphone 如何更改UITableview中选定行和未选定行的颜色?

Iphone 如何更改UITableview中选定行和未选定行的颜色?,iphone,objective-c,uitableview,Iphone,Objective C,Uitableview,当用户从uitableview中选择特定行时,我想更改选中行和未选中行的颜色 告诉我示例代码或它的任何链接。 在cellforrowatinexpath方法中提前感谢 设置的backgroundView和selectedBackgroundView属性 您只需创建一个具有所需背景颜色的新UIView对象,并将该视图指定给属性 UIView *normalView = [[UIView alloc] initWithFrame:cell.bounds]; normalView.background

当用户从uitableview中选择特定行时,我想更改选中行和未选中行的颜色

告诉我示例代码或它的任何链接。
cellforrowatinexpath
方法中提前感谢

设置的
backgroundView
selectedBackgroundView
属性

您只需创建一个具有所需背景颜色的新UIView对象,并将该视图指定给属性

UIView *normalView = [[UIView alloc] initWithFrame:cell.bounds];
normalView.backgroundColor = [UIColor blueColor];
cell.backgroundView = normalView;
[normalView release];
对于
selectedBackgroundView
,情况类似

然后终于定下来了

[cell.textLabel setBackgroundColor:[UIColor clearColor]];
通过更改红色、绿色、蓝色的值,可以在选中时更改单元格的颜色

cell.contentView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.25];