tableview cell 点击延迟响应问题

自己遇到的问题, 当我把cell的selectionStyle设置为 UITableViewCellSelectionStyleNone的时候,点击发生响应延迟的bug。不明所以然,以前貌似没碰到这个情况。

解决办法:cell的selectionStyle用UITableViewCellSelectionStyleDefault,会有点击背景颜色的,如果你在

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

背景色会一闪而过的,如果你想要UITableViewCellSelectionStyleNone的效果,那就去改变cell的selectedBackgroundView。如下:

UIView *view= [[UIView alloc] initWithFrame:cell.frame];
view.backgroundColor=[UIColor clearColor];
cell.selectedBackgroundView=view;

这样就没什么问题了。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容