[英]Change to custom background when a cell is highlighted
选择自定义单元格后,如何更改其背景?
谢谢,尼尔斯
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
UIView *v = [[[UIView alloc] init] autorelease];
v.backgroundColor = [UIColor blueColor];
cell.selectedBackgroundView = v;
用这个
您需要UITableViewCell
,并重写以下方法:
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated;
- (void)setSelected:(BOOL)selected animated:(BOOL)animated;
您可以在那里更改单元格的背景图像。
单元格的selectionStyle
属性也允许一些非常基本的自定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.