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 })
])
}
}
}