Prefer Large Titles and RefreshControl not working well
If you were using tableView.tableHeaderView = refreshControl
or tableView.addSubView(refreshControl)
you should try using tableView.refreshControl = refreshControl
It seems there are a lot of different causes that could make this happen, for me I had a TableView embedded within a ViewController. I set the top layout guide of the tableview to the superview with 0. After all of that still nothing until I wrapped my RefreshControl end editing in a delayed block:
DispatchQueue.main.async {
if self.refreshControl.isRefreshing {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: {
self.refreshControl.endRefreshing()
})
}
}
At the end what worked for me was:
In order to fix the RefreshControl progress bar disappearing bug with large titles:
self.extendedLayoutIncludesOpaqueBars = true
In order to fix the list offset after
refreshcontrol.endRefreshing()
:let top = self.tableView.adjustedContentInset.top let y = self.refreshControl!.frame.maxY + top self.tableView.setContentOffset(CGPoint(x: 0, y: -y), animated:true)
I'm having the same problem, and none of the other answers worked for me.
I realised that changing the table view top constraint from the safe area to the superview fixed that strange spinning bug.
Also, make sure the constant value for this constraint is 0 ð¤¯.