Without prefersLargeTitles, I should have to pull down a bit before the UIRefreshControl begins the refresh, but when I turn on large titles, it starts instantly.
I have removed the Storyboard and I am trying to create everything programatically.
What am I missing?
import Foundation
import UIKit
class TweakManagerViewController: UIViewController {
var tableView = UITableView()
var refreshControl = UIRefreshControl()
override func viewDidLoad() {
super.viewDidLoad()
setupTableView()
self.navigationController?.navigationBar.prefersLargeTitles = true
self.title = "Title"
}
func setupTableView() {
tableView.refreshControl = refreshControl
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
tableView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
tableView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
}
}
2
Answers
I was finally able to solve it. I was supposed to use a UITableViewController, not a UIViewController. After switching to a UITableViewController, everything works as expected.
You have added everything correctly make sure that you have also added the target action to make the UIRefreshControl work as expected