`

UITableViewCell被选中时样式的自定义问题

    博客分类:
  • iOS
UP 
阅读更多

 

  我自定义了一个cell,想在选中时,自定义一个图片作为其背景.

 

这两天遇到这样的问题:

  我自定义了一个cell,想在选中时,自定义一个图片作为其背景.

 

于是乎我在cell的类中方法- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

	
    [super setSelected:selected animated:animated];
	
	if (selected) {
		_bgImgView.image = [UIImage imageNamed:@"bg_whtie.png"];
	} else {
		_bgImgView.image = [UIImage imageNamed:@"bg_green.png"];
	}
	
}

 but which do not work.

 then,i look up the document and find 

cell.selectionStyle = UITableViewCellSelectionStyleNone;

add this ,which work good.

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics