I'm trying to use the standard UIRefreshControl
and UISearchController
on a UITableViewController
. However it doesn't look like it does what it's supposed to. When refreshing, scrolling leaves the navigation bar with a big blank area, presumably where the spinner is supposed to be:
I have a sample project on GitHub. Here's how the controls are set up:
override func viewDidLoad() {
super.viewDidLoad()
let spinner = UIRefreshControl()
spinner.addTarget(self, action: #selector(refresh), for: .valueChanged)
refreshControl = spinner
searchController = UISearchController(searchResultsController: nil)
navigationItem.searchController = searchController
}
I've tried assigning the refresh control to the property on UITableView
instead of the one on UITableViewController
, that doesn't make a difference.
Has anyone come across the same issue?
You can use UIRefreshController in the old way, which is like this:
override func viewDidLoad() {
super.viewDidLoad()
let spinner = UIRefreshControl()
spinner.addTarget(self, action: #selector(refresh), for: .valueChanged)
self.tableView.addSubview(spinner)
searchController = UISearchController(searchResultsController: nil)
navigationItem.searchController = searchController
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With