navigationItem.title now showing in iOS 18 UITabBarController

navigationItem.title does not display on the first view controller in the new UITabBarController on iPad. Also, if I set navigationItem.titleMenuProvider an empty space is displayed. Everything displays as expected if it isn’t the first view controller.

 let tabBarController = UITabBarController(tabs: [
            UITab(title: "Tab 1", image: nil, identifier: "tab1", viewControllerProvider: { _ in
                return UINavigationController(rootViewController: ViewController())
            })
        ])
class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.title = "First"
        navigationItem.titleMenuProvider = { suggestions in
            return UIMenu(children: [
                UIAction(title: "Option 1", handler: { _ in
                    self.navigationController?.pushViewController(SecondViewController(), animated: true)
                }),
                UIAction(title: "Option 2", handler: { _ in })
            ])
        }
    }
}

class SecondViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.title = "Second"
        navigationItem.titleMenuProvider = { suggestions in
            return UIMenu(children: [
                UIAction(title: "Option 1", handler: { _ in }),
                UIAction(title: "Option 2", handler: { _ in })
            ])
        }
    }
}

Answered by Frameworks Engineer in 803128022

No title on the root item is expected for the case where titleMenuProvider==nil. For the case where it is non-nil, we should be showing the title normally – so that sounds like a bug. It would be appreciated if you could file one and report the feedback number.

Title should read "navigationItem.title NOT showing in iOS 18 UITabBarController"

No title on the root item is expected for the case where titleMenuProvider==nil. For the case where it is non-nil, we should be showing the title normally – so that sounds like a bug. It would be appreciated if you could file one and report the feedback number.

FB14996493

navigationItem.title now showing in iOS 18 UITabBarController
 
 
Q