【发布时间】:2011-04-27 03:42:34
【问题描述】:
我们可以改变表格视图的选择颜色,即单元格,默认为蓝色,那么,我们可以将其更改为任何其他颜色吗?
问候
【问题讨论】:
标签: iphone
我们可以改变表格视图的选择颜色,即单元格,默认为蓝色,那么,我们可以将其更改为任何其他颜色吗?
问候
【问题讨论】:
标签: iphone
代码中的这种方式
aCell.selectedBackgroundView = [[[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"selectedBackground.png"]] autorelease];
或者你可以在界面生成器中将其设置为灰色,我认为蓝色和灰色是所有可用的,而无需创建 be 视图
【讨论】:
另一种不需要图像文件的方法是:
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;
【讨论】: