问题
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 方法中
执行将要进行的操作