我有一个UITableView,其中的单元格具有UIImages作为主要内容。 Table View是分页的,所以当我接近UITableView的末尾时,我向API发出了一个新请求,并插入了新的单元格(无限滚动)。

问题在于,当来自API的数据到达时,我将它们添加到表格 View 中,滚动完全停止。

我尝试过

[tableview reloadData]


[tableview beginUpdates]
[tableview insertRows...]
[tableview endUpdates]

但是滚动动画在两种情况下都完全停止。

最佳答案

我只是发现了问题:新数据到达后,我有了一个UIRefreshControl调用[self.refreshControl endRefreshing]。并且由于某种原因,该方法停止了表格 View 中的所有滚动动画。

通过增加

if ([self.refreshControl isRefreshing]) {
    [self.refreshControl endRefreshing];
}

问题解决了。

关于ios - 添加新行时,UITableView停止滚动,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31680539/

10-12 01:49
查看更多