Reputation: 81
I have a UITableViewController with a UINavigationBar with the property :
navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .automatic
I add in the UITableViewController a UISearchController with the easiest way :
private func setupSearchController() {
searchResultsController = SearchResultsController()
searchController = UISearchController(searchResultsController: searchResultsController)
searchController?.searchResultsUpdater = searchResultsController
searchController?.obscuresBackgroundDuringPresentation = true
searchController?.searchBar.tintColor = R.color.primaryText()
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
definesPresentationContext = true
}
If the UITableView is empty the UI looks good, but if I add at least 1 row, the simplest like this :
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
At launch the Large Title of the UINavigationBar is collapsed. If I scroll down the UITableView I get the Large Title back.
It looks like adding something to the UITableView make it scrolling. How can I prevent the UINavigationBar to be collapsed at launch?
Upvotes: 0
Views: 97