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)
for second issue:
in SceneDelegate: var window: UIWindow?
in the function scene put this line:
window?.backgroundColor = .yourColor
like this:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
window?.backgroundColor = .white
}
set the color you want and that's it :)