UITableView stops scrolling when adding new rows

I have a UITableView with cells that have UIImages as the main content. The table view is paginated, so when I approach the end of the UITableView, I make a new API request and insert new cells (infinite scroll).

The problem is that when the data from the API comes in and I add it to the table view, the scroll stops completely.

I tried with

[tableview reloadData] 

and

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

But the scroll animation stops completely in both cases.

+5
source share
1 answer

I just found a problem: after the new data appeared, I had a call to UIRefreshControl [self.refreshControll endRefreshing] . And for some reason, this method stopped the scroll animation in the table view.

By adding

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

the problem was solved.

+22
source

All Articles