Attempted to access the table view‘s visibleCells while they were in the process of being updated

问题

tableView的pagingEnabled = YES; 但是会出现一种情况

tableView 停止滚动的偏移量不是高度的整数倍

同时,打印台回报出下面的错误信息
[Assert] Attempted to access the table view’s visibleCells while they were in the process of being updated, which is not allowed. Make a symbolic breakpoint at UITableViewAlertForVisibleCellsAccessDuringUpdate to catch this in the debugger and see what caused this to occur. Perhaps you are trying to ask the table view for the visible cells from inside a table view callback about a specific row? Table view: <HeaderInsetTableView: 0x106261000; baseClass = UITableView; frame = (0 0; 375 667); clipsToBounds = YES; autoresize = LM+W+RM+H+BM; gestureRecognizers = <NSArray: 0x282fe95c0>; layer = <CALayer: 0x2821b9000>; contentOffset: {0, 34629.5}; contentSize: {375, 53360}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <TPVerticalVideoDetailViewController: 0x10627de00>>

原因

我们在停止减速的时候,同时调用了连个方法,一个是播放视频,这里会调用,另一个方法
是请求更多,这里会更新tableView,
请添加图片描述

请添加图片描述
请添加图片描述

请添加图片描述

由于同时调用者两个方法会造成UI卡顿,这就解释了为什么
会滚动的偏移量不是高度的整数倍

解决方法

主动滚动到正数倍的偏移量
请添加图片描述

并在scrollViewDidEndScrollingAnimation 方法中
执行将要进行的操作
请添加图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值