我的非常简单的应用程序遇到了麻烦。
我的应用程序只有两个主要内容,UIViewControllers称为新闻和类别,每个都有自己的UINavigationController.
所以在AppDelegate.swift,我这样做了
window = UIWindow(frame: UIScreen.main.bounds)
let tabBarController = UITabBarController()
let newsVC = NewsVC()
// CREATE TAB BAR ITEM WITH TITLE ONLY
let newsVCTabBarItem = UITabBarItem(title: "News", image: nil, tag: 1)
newsVC.tabBarItem = newsVCTabBarItem
let categoryVC = CategoryVC()
// CREATE TAB BAR ITEM WITH TITLE ONLY
let categoryVCTabBarItem = UITabBarItem(title: "Category", image: nil, tag: 2)
categoryVC.tabBarItem = categoryVCTabBarItem
let rootViewControllers = [newsVC, categoryVC]
// CREATE NAVIGATION CONTROLLER FOR EACH OF THEM
tabBarController.viewControllers = …Run Code Online (Sandbox Code Playgroud)