I'm trying to add a table view programmatically, but large title doesn't show.
Here is my code:
self.view.addSubview(module.tableView)
module.view.translatesAutoresizingMaskIntoConstraints = false
if #available(iOS 11.0, *) {
NSLayoutConstraint.activate([
module.view.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor, constant: 0),
module.view.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor, constant: 0),
module.view.leadingAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.leadingAnchor, constant: 0),
module.view.trailingAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.trailingAnchor, constant: 0)
])
}
Note: large titles enabled in view controller
if #available(iOS 11.0, *) {
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always
}
Maybe it's important: I'm trying to add a table as a child view controller. My child controller is a UITableViewController. And if I add child view in viewDidLoad()
large title shows but doesn't scroll.
Here is the link to file where I'm adding my child module. Detail code you can see in question or here in addChild(module:)
method.
Let me know how to fix this bug please.