I have a UITableView and a Detail View embedded in a UINavigationController as so: I would like to turn on large titles for "My Notes" but I'd like to turn it off for the detail view. Something like how the default Mail app works on iPhone. How would I change the navigation bar's prefersLargeTitle
property during that segue?
it's very simple.
In your DetailView you should set navigationItem.largeTitleDisplayMode to .never
(not navigationController?.navigationItem.largeTitleDisplayMode !!)
navigationItem.largeTitleDisplayMode = .never
.navigationBarTitle("Title", displayMode: .inline)
Any one of both of following, will solve your problem:
set prefersLargeTitles to false for your navigationBar
self.navigationController?.navigationBar.prefersLargeTitles = false
set largeTitleDisplayMode to never for navigationItem (note: prefersLargeTitles must be false otherwise this won't work)
self.navigationController?.navigationItem.largeTitleDisplayMode = .never
Note: if prefersLargeTitles
is true, then largeTitleDisplayMode = .never won't work. Small title display for navigation bar is dependent on prefersLargeTitles
This will enable large title mode if it's value is true
self.navigationController?.navigationBar.prefersLargeTitles = true
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