UITableView stops scrolling when adding new rows

╄→гoц情女王★ 提交于 2019-12-23 07:49:06

问题


I have a UITableView with Cells that have UIImages as main content. The Table View is paginated, so when I'm near the end of the UITableView I make a new Request to the API and insert the new cells (infinit scrolling).

The problem is that when the data from the API arrives, and I add them to the table view, the scrolling stops completly.

I've tried with

[tableview reloadData]

and

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

But the Scrolling animation stops completly in both cases.


回答1:


I just found the problem: After the new data arrived I had a UIRefreshControl calling [self.refreshControl endRefreshing]. And for some reason that method stopped all scrolling animation in the table view.

By adding

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

the problem was solved.



来源:https://stackoverflow.com/questions/31680539/uitableview-stops-scrolling-when-adding-new-rows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!