简体   繁体   English

更改表格视图的单元格选择颜色

[英]change table view's cell selection color

can we change the selection color of table view, ie cell, by default its blue, so, can we change it to any other color? 我们是否可以更改表格视图的选择颜色,即单元格,默认情况下为蓝色,那么我们可以将其更改为任何其他颜色吗?

regards 问候

Another way to do this, that doesn't require an image file is: 不需要图像文件的另一种方法是:

UIView *bgView = [[UIView alloc] init];
// At least on iOS6 you don't to size the view for this to work.
bgView.backgroundColor = [UIColor grayColor];
aCell.selectedBackgroundView = bgView;

this way in code 这种方式在代码中

aCell.selectedBackgroundView = [[[UIImageView alloc] 
      initWithImage:[UIImage imageNamed:@"selectedBackground.png"]] autorelease];

or you can set it in interface builder to gray, I think blue and grey is all that is available without creating a be view 或者您可以在“界面生成器”中将其设置为灰色,我认为蓝色和灰色就是全部可用而无需创建be视图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM