【问题标题】:How to activate UINavigationController and switch between them如何激活 UINavigationController 并在它们之间切换
【发布时间】:2012-09-05 04:38:46
【问题描述】:

我基于UIViewControllerUIButtons 构建了自己的TabBarController。我用 UINavigationController(s) 准备了我的 viewControllers。

如何激活这些视图,如何在它们之间切换以及如何将 myTabBarController 保持在顶部?

【问题讨论】:

    标签: ios uinavigationcontroller tabbar


    【解决方案1】:

    你的结构应该是这样的:

    TabBarController
    |
    |
    |____NavController1
    |    |
    |    |
    |    |____RootVC1
    |
    |
    |____NavController2
    |    |
    |    |
    |    |____RootVC2
    |
    |
    |____NavController3
    |    |
    |    |
    |    |____RootVC3
    |
    

    在您的应用委托中,您将根视图控制器设置为您的 tabBarController 控制器。

    然后对于每个自定义选项卡切换按钮,您可以告诉 tabBarController 根据按下的按钮设置选定的索引:

    -(void)button1Pressed
    {
        myTabBarController.selectedIndex = 1;
    
        // you might want to set your button's enabled graphic and set other button to disable graphic
    }
    

    【讨论】:

    • 谢谢。我没有使用 TabBarController,我尝试自己构建它。我如上所述转移了 NacControllers 数组,我想知道如何使用它们。 SubView、pushViewController 或 presentModalViewController 对我不起作用。激活这些 NacControllers+RootVC 的正确方法是什么
    猜你喜欢
    • 1970-01-01
    • 2019-08-11
    • 2012-09-07
    • 2010-10-28
    • 2013-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-27
    相关资源
    最近更新 更多