您的位置:首页 > 产品设计 > UI/UE

UITableViewCell点击时背景颜色

2015-06-24 10:59 316 查看
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 = [UIColorclearColor];

          cell.selectedBackgroundView = view_bg;

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

 

[tableView deselectRowAtIndexPath:indexPathanimated:NO];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: