ios 导航栏设置隐藏后无效的问题

基本框架是用的UITabBarController+UINavigationController,在AppDelegate中添加了四个tab页
在tab页中,点击跳转二级页面是,设置隐藏导航栏,确始终会显示,不知道是哪里错了,有大佬能指点一二吗

AppDelegate中初始化代码:

HomeVC *homeVC = [[HomeVC alloc] init];
    FindVC *findVC = [[FindVC alloc] init];
    WorkRoomVC *workVC = [[WorkRoomVC alloc] init];
    MineVC *mineVC = [[MineVC alloc] init];

    UINavigationController *navHome = [[UINavigationController alloc]initWithRootViewController:homeVC];
    UINavigationController *navFind = [[UINavigationController alloc]initWithRootViewController:findVC];
    UINavigationController *navWork = [[UINavigationController alloc]initWithRootViewController:workVC];
    UINavigationController *navMine = [[UINavigationController alloc]initWithRootViewController:mineVC];

        UITabBarController *tabBar = [[UITabBarController alloc] init];
    [tabBar addChildViewController:navHome];
    [tabBar addChildViewController:navFind];
    [tabBar addChildViewController:navWork];
    [tabBar addChildViewController:navMine];

    tabBar.tabBar.translucent = NO;
    tabBar.delegate = self;
    self.window.rootViewController = tabBar;


在HomeVC中点击跳转:

SearchVC *vc = [[SearchVC alloc] init];
        vc.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:vc animated:YES];

SearchVC中设置不显示导航栏:

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;
    [self.navigationController setNavigationBarHidden:YES];
}

图片说明

weixin_43343044
薇姐的男人 最后是发现,将 [self.navigationController setNavigationBarHidden:YES]; 写在viewDidAppear中就好了
大约 2 个月之前 回复

1个回答

weixin_43343044
薇姐的男人 多谢回复,内容并非问题答案
大约 2 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问