更改所选单元格的背景颜色? [英] Changing background color of selected cell?
本文介绍了更改所选单元格的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁知道如何改变使用的UITableViewCell一个单元格的背景颜色,对于每个所选小区?我创造了这个的UITableViewCell的code代表的TableView内。
Does anyone know how to change the background color of a cell using UITableViewCell, for each selected cell? I created this UITableViewCell inside the code for TableView.
推荐答案
更改属性selectedBackgroundView是正确的,最简单的方法。我用下面的code键更改选择的颜色:
Changing the property selectedBackgroundView is correct and the simplest way. I use the following code to change the selection color:
// set selection color
UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
myBackView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:0.75 alpha:1];
cell.selectedBackgroundView = myBackView;
[myBackView release];
这篇关于更改所选单元格的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文