iOS(二) UITableViewCell点击时背景颜色

1.点击UITableViewCell时,在cellForRowAtIndexPath方法中写上,没有点击效果。

cell.selectionStyle = UITableViewCellSelectionStyleNone;

2.点击cell 摁下 一闪而过,didSelectRowAtIndexPath方法加上写

[tableView deselectRowAtIndexPath:indexPath animated:NO];

3.自定 点击后的颜色   在cellForRowAtIndexPath方法

UIView *view = [[UIView alloc]init];
       view.backgroundColor=[UIColor redColor];
       cell.selectedBackgroundView=view;

猜你喜欢

转载自blog.csdn.net/jack_bob/article/details/104468516