美文网首页
tableview cell 点击延迟响应问题

tableview cell 点击延迟响应问题

作者: 水煮杰尼龟 | 来源:发表于2017-07-25 13:18 被阅读23次

自己遇到的问题, 当我把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;

这样就没什么问题了。

相关文章

网友评论

      本文标题:tableview cell 点击延迟响应问题

      本文链接:https://www.haomeiwen.com/subject/ptjwkxtx.html