if(!isUserLoggedIn){

        var loginViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("loginView") as! LoginViewController

        window!.rootViewController = loginViewController
        window!.makeKeyAndVisible()

    }else{

        var mainViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("mainView") as! FirstViewController
        var myDealsViewController  = mainStoryBoard.instantiateViewControllerWithIdentifier("myDealsViewController") as!MyDealsViewController
        var settingsViewController  = mainStoryBoard.instantiateViewControllerWithIdentifier("settingsView") as! SettingsViewController
        var centerNav = UINavigationController(rootViewController: mainViewController) as UINavigationController
        var myDealNavController = UINavigationController(rootViewController: myDealsViewController) as UINavigationController
        let controllers = [centerNav,myDealNavController,settingsViewController]
        tabBarController.viewControllers = controllers

        window!.rootViewController = tabBarController
        window!.makeKeyAndVisible()
    }


上面的代码正常工作,但是应用程序未显示选项卡栏项,即使单击中心选项卡栏项时它也可以工作。

最佳答案

将代码行替换为:

var myDealNavController = mainStoryBoard.instantiateViewControllerWithIdentifier("myDealNavController") as! UINavigationController


并在情节提要中将“ myDealNavController”设置为您的UINavigationController的标识符。

关于ios - 标签栏项目未显示,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29843497/

10-12 06:02