I would like to disable the task bar after changing the ViewController programmatically. I have a hover button. After a click on it this code is called to change the ViewController:
self.navigationController?.setViewControllers([lvc!], animated: true)
This works well. After the change I am calling the viewDidLoad method which is also called (checked the console). The code is like this:
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.tabBar.isUserInteractionEnabled = false
}
The button is in the HomeView. If I am calling self.tabBarController?.tabBar.isUserInteractionEnabled = false
in the viewDidLoad method of the HomeView the tab bar is disabled. I am using NavigationController for presenting the different Views.
Any idea why the tab bar is not disabled and how to fix it?
Try this:
_ = tabBarController?.tabBar.items?.compactMap { $0.isEnabled = false }