隐藏TopBar

时间:2014-07-27 23:16:58

标签: objective-c

我试过隐藏顶部导航栏的3种方法,但它没有隐藏。

    viewLidAppear中的
  1. 我试过

    [self.navigationController setToolbarHidden:YES];
    
  2. 使用此代码

    符合UINavigationControllerDelegate
    (void)navigationController:(UINavigationController *)navigationController
                  willShowViewController:(UIViewController *)
                            viewController animated:(BOOL)animated
    {
    
    
    
    BOOL shouldHide = [viewController.toolbarItems count] == 0;
    [navigationController setToolbarHidden:shouldHide animated:animated];
    
    
    }
    
  3. 在检查器中TopbarHidden也设置为True,当我将nib加载到UIView中时......

    UINavigationController *NAV_instructions = [[UINavigationController alloc] initWithRootViewController:instructions];
    
    [NAV_instructions setToolbarHidden:YES];
    [NAV_instructions setModalTransitionStyle:UIModalTransitionStylePartialCurl];
    

    如何隐藏到顶部栏?

1 个答案:

答案 0 :(得分:0)

试试这个:

self.navigationController.navigationBarHidden = YES;