Reputation: 230
Let me start by saying I have implemented Refresh Control throughout the application I'm working on and understand how it works when used inside a navigation controller with a visible navigation bar. Specifically, my question here is how to use it when the navigation bar is hidden. I have a view controller that is the root view controller (not sure that matters) of a navigation controller and in the viewWillAppear
hook, I am hiding the navigation bar. The refresh control functionality is working when the user pulls down but you can't see the indicator at all. Any good solutions for solving this problem?
Here is the code that adds the refresh control to the scrollview subclass:
self.refreshDelegate = delegate
self.refreshControl = UIRefreshControl()
self.refreshControl?.tintColor = .white
self.refreshControl?.addTarget(self, action: #selector(triggerRefresh), for: .valueChanged)
Upvotes: 0
Views: 1093
Reputation: 760
Had the same issue, looks like an iOS bug.
Solution i found:
self.navigationController?.setNavigationBarHidden(true, animated: false)
scrollView.refreshControl = yourRefresh
So, order is important. With this solution refresh control is visible while navigation bar is hidden.
Upvotes: 2