My goal is to display a tab view controller that manages multiple tabs that consist of navigation controllers containing view controllers.
I set the tab view controller BaseTabBarController
as window my root view controller in AppDelegate. My custom tab view controller looks like this:
class BaseTabBarController: ESTabBarController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
let v1 = BaseNavigationController(rootViewController: SubscriptionsController())
let v2 = BaseNavigationController(rootViewController: SubscriptionsController())
v1.tabBarItem = ESTabBarItem(title: "Home", image: #imageLiteral(resourceName: "tab_bar_home"), selectedImage: #imageLiteral(resourceName: "tab_bar_home"))
v2.tabBarItem = ESTabBarItem(title: "Home", image: #imageLiteral(resourceName: "tab_bar_home"), selectedImage: #imageLiteral(resourceName: "tab_bar_home"))
self.viewControllers = [v1, v2]
self.hidesBottomBarWhenPushed = true
}
}
My custom navigation controller class is an empty subclass of a navigation controller.
The problem is that the app displays a tab bar for a fraction of a second, and immediately turns into a black screen (console message: "Presenting view controllers on detached view controllers is discouraged"). What did I do wrong?