I have a UITabBar that currently has 4 tabs and it works great. I need to navigate to a new set of tabs as if the app was entering a different mode. Pushing the new UITabBar via the navigationController doesn't work – it currently just adds a new UITabBar on top of the old one and adds a new UINavigationBar
under the old one. Would I create a whole new UIWindow whose rootViewController is my new UITabBarController
?
@objc func startSecondStory() {
let newTabs = SecondaryTabBarController()
navigationController?.pushViewController(newTabs, animated: true)
}
The code is the action of a pushed UIButton. I don't want the new UITabBar to be pushed on top of the stack. I'd prefer it just took as a whole new UINavigationController with the rootView as SecondaryTabBarController.
You can use ( this will clear previous one)
self.navigationController?.setViewControllers([newTabs],animated:true)
//
UIApplication.shared.keyWindow?.rootViewController = newTabs