UITableViewCell点击时背景颜色

来源:互联网 发布:巨人网络招聘2017 编辑:程序博客网 时间:2024/09/21 08:59
1.点击UITableViewCell时,没有点击效果,cellForRowAtIndexPath:方法中写上

cell.selectionStyle = UITableViewCellSelectionStyleNone;


2.点击UITableCell时,Cell背景颜色不变,但是上面自定义的控件如:UILabel、UIImageView会变颜色

设置UILabel或UIImageView的Highlighted 然后 在cellForRowAtIndexPath:方法中写上

            UIView *view_bg = [[[UIView alloc]initWithFrame:cell.frame]autorelease];

            view_bg.backgroundColor = [UIColor clearColor];

            cell.selectedBackgroundView = view_bg;


3.点击cell行时,背景颜色一闪而过,didSelectRowAtIndexPath:方法中写上

 

[tableView deselectRowAtIndexPath:indexPath animated:NO];

1 0
原创粉丝点击