My navigationItem.title behaves in a strange way.
When the viewController is pushed on to stack the title is not showing (top image). However, while viewController gets popped, the title becomes visible for a nanosecond or so (see bottom image).
This is how I set the title and add the barButtons. All in viewDidLoad.
navigationItem.title = "Mitt konto"
let backBtn = UIButton(type: .custom)
let backBtnImage = UIImage(systemName: "chevron.left")
backBtn.setBackgroundImage(backBtnImage, for: .normal)
backBtn.addTarget(self, action: #selector(popViewController), for: .touchUpInside)
backBtn.frame = CGRect(x: 0, y: 0, width: 20, height: 20)
let backBtnView = UIView(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
backBtnView.bounds = view.bounds.offsetBy(dx: 0, dy: -10)
backBtnView.addSubview(backBtn)
let backButton = UIBarButtonItem(customView: backBtnView)
navigationItem.leftBarButtonItem = backButton
let signOutImage = UIImage(named: "signout_item")?.withTintColor(.white)
let button = UIButton(frame: CGRect(x: 0,y: 0,width: 20, height: 20))
button.setBackgroundImage(signOutImage, for: .normal)
button.addTarget(self, action: #selector(signoutButtonPressed(_:)), for: .touchUpInside)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: button)
UPDATE My view hierarchy is NavigationController -> AnotherViewController -> ThisViewController
Where's my misstake? What is hiding the title?