I'm using the large title on the navigation bar, and when I tap on a cell to go on the next controller, the large title has a strange animation (as you can see on the gif below). It's doesn't disappear immediately.
I tried the following solution but nothing (https://www.morningswiftui.com/blog/fix-large-title-animation-on-ios13)
My Code:
On the first View Controller:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationItem.title = "New Order"
navigationController?.navigationBar.prefersLargeTitles = true
}
On the Second View Controller (With the large title):
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationItem.title = "Menu"
self.navigationController?.navigationBar.prefersLargeTitles = false
}
Edit:
Fabio's answer is the solution but now I have another problem:
When I tap on a cell a part of the navigation bar is black (as you can see below)
Try to insert On the first View Controller:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationItem.title = "New Order"
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always
}
and On the Second View Controller:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationItem.title = "Menu"
navigationItem.largeTitleDisplayMode = .never
}
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