1 year ago
#31885
lauwis premium
Push viewController not showing in AppDelegate
Try to push new viewController(InboxController) from rootViewController , rootViewController is UITabBar. But, pushViewController not showing anything and only show rootViewController
// 1
guard let tabBarController = window?.rootViewController as? UITabBarController else {
return
}
// 2
guard let tabBarControllers = tabBarController.viewControllers,
let listIndex = tabBarControllers.firstIndex(where: { $0 is UINavigationController }),
let listViewController = tabBarControllers[listIndex] as? UINavigationController else { return }
// 3
listViewController.popToRootViewController(animated: false)
tabBarController.selectedIndex = listIndex
// 4
let detailViewController = InboxController()
listViewController.pushViewController(detailViewController, animated: true)
window?.rootViewController = listViewController
window?.makeKeyAndVisible()
swift
uitabbarcontroller
appdelegate
pushviewcontroller
0 Answers
Your Answer