I have a UITableViewController
with the built-in UIRefreshControl
. I have two issues with the refresh animation which I want to fix.
When I drag and pull the table view, it starts to update data from our server. If the user keeps it dragging, a noticeable offset jump occurs.
When the refresh operation ends, the table view hides the refresh control animated. After it finishes hiding it, the control flashes for a a few frames.
The control is set up from UIStoryboard. I set up target and tint color from there. When the action fires my code refreshes the data from our server, which has a callback when the server responds. I stop the refresh control from there:
dispatch_async(dispatch_get_main_queue(), ^{
[self.refreshControl endRefreshing];
});
...
[self.tableView reloadData];
Is something I do wrong or UIRefreshControl
is just buggy in iOS 11?
I was experiencing a similar issue and this is how I finally fixed it:
The 'estimated row height' property needs to be set. Otherwise, reloadData()
causes a noticeable jump. This is explained here
Calling endRefreshing()
while the user is still dragging also results in a noticeable jump. To avoid this:
UIScrollView.isDragging
). If this is the case then I don't call endRefreshing()
immediately, but set a flag instead.scrollViewDidEndDragging
and check the flag there; if set, then I call endRefreshing()
and clear the flag.