My large title does shrink normally when scrolled, just like it's supposed to. But, it doesn’t come back large again even when I scroll to the top. When I build the project and open the app for the first time, the large title and search bar appear normally but once it shrinks. It doesn't come back before I finish the app. It happens the same on my device as well.
I am using tableView
with ViewController
, with searchBar
in the navigation title
. I also have tableview header
under the navigation bar.
The way my large title works:
The way it's supposed to work:
I have added a searchController
inside the navigation bar, but I don't think searchController
is the problem because the same problem happens even when I remove the search bar from my project. Also, I have used the same code making large titles in those two different projects in the GIFs, but one works and one doesn't. Why is it?
I put this in the viewDidLoad()
.
navigationController?.navigationBar.prefersLargeTitles = true
I also tried:
navigationItem.largeTitleDisplayMode = .always
But, it didn't work.
I also tried putting:
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always
those two in viewWillAppear()
but it didn't work as well.
-Edit-
The tableView
is the first in the view hierarchy, as well. Please let me know if there's something wrong with the hierarchy.
The image of my document outline: