tableviewcell透明

对于group的tableview  要向设置其cell背景色完全透明有点困难,通常的设置都无法彻底去掉背景色,以下方法可以解决问题,并可以为每个cell都加上边框(当然,想完全透明就别加setBorderWidth)

            [cell setBackgroundColor:[UIColor clearColor]];

            UIView *tmp=[[UIView alloc] init];

            [cell setBackgroundView:tmp];

            [[tmp layer] setBorderWidth :1];

            [[tmp layer]setBorderColor:[[UIColor grayColor] CGColor]];

            [tmp release];

 

自定义TableViewCell注意事项:didDeselectRowAtIndexPath不响应

1. 如果你的cell是自定义的,如果在自定义的类里边加入了诸如:

 

 -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;的方法,那么后边,你可能就悲催了,你会发现,不过你怎么该,

 

-(void)tableView:(UITableView *)_tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath

和-(void)tableView:(UITableView *)_tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath两个代理方法基本不会被调用(为什么说“基本”,因为笔者的table是点击4到6次就会触发一次)。

2.UITableView selectRowAtIndexPath 不回调 didSelectRowAtIndexPath 解决方案

Apple’s documentation says that didSelectRowAtIndexPath:index will not be invoked whenselectRowAtIndexPath:indexPath is called. To call didSelectRowAtIndexPath use the following:

 [[tableView delegate] tableView:yourtableView didSelectRowAtIndexPath:index];

This basically invokes the delegate.

3.如果没写代理

转载于:https://www.cnblogs.com/ChrisYu/p/4886128.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值