【问题标题】:Customer UITabbarController , show and hide When present to a new view?客户 UITabbarController ,显示和隐藏何时出现在新视图中?
【发布时间】:2014-01-04 16:21:37
【问题描述】:

我自定义了一个UITabbarController,给了5个NavigationController,比如:

    WXCustomerBar* bar = [[WXCustomerBar alloc]init];   
[bar setViewControllers:[NSArray arrayWithObjects:
                             [[UINavigationController alloc]initWithRootViewController:[[IndexView alloc]init]],  [[UINavigationController alloc]initWithRootViewController:[[SecondView alloc]init]]

indexView 中显示标签栏,当我单击按钮以呈现另一个视图settingView 我想隐藏标签栏。然后,当我单击 settingView 中的按钮,呈现到 SecondView 中时,我想显示标签栏。

这是我目前的方法:

-(void)presentToNetViewController:(id)viewController
{
    if (![viewController isKindOfClass:[WXCustomerBar class]]) {
        UINavigationController* navi = [[UINavigationController alloc]initWithRootViewController:viewController];
        [self presentViewController:navi animated:YES completion:nil];
    }else
    {
        [self presentViewController:viewController animated:YES completion:nil];
    }

}

我不是英语,抱歉我的语言不通。

【问题讨论】:

    标签: ios7 uitabbarcontroller show hidden


    【解决方案1】:

    UIViewController 有一个hidesBottomBarWhenPushed 属性。将此设置为YES,当您执行[self presentViewControlller: viewController animated: YES completion: nil] 时,该栏将自动隐藏,直到您按下返回按钮。

    除此之外,您还可以通过这样做来告诉 UITabBarController 本身隐藏:

    [self hideTabBar: self.navigationController.tabBarController];

    您可以查看此答案以了解更多信息:How to hide uitabbarcontroller

    【讨论】:

    • 这个属性我试过了,但没有成功, hidesBottomBarWhenPushed 只适用于非客户标签栏
    • 它对我有用。确保为视图控制器设置属性,而不是标签栏。
    • 呃,昨天,当出现在下一页时,我尝试关闭当前的视图控制器:
    • 它就像 self dismisViewcontroller]; tabbar selectIndex:] 让 tabbarcontroller 呈现页面
    猜你喜欢
    • 2018-03-07
    • 1970-01-01
    • 1970-01-01
    • 2016-02-22
    • 2015-01-15
    • 1970-01-01
    • 2018-02-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多