Storyboard - Hiding top bar of navigation controller programmatically

前端 未结 8 736
失恋的感觉
失恋的感觉 2020-12-13 14:11

I\'m using a storyboard and I\'m trying to hide a top bar of my main navigation controller when a certain button is pressed (or function is called). I know I have to initial

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 14:32

    Finally solved it. You should always hide navigation bar only through viewController.

    In my question above I instantiated a whole new navigationController which didn't point at the real navController on the screen. You can obtain the "real" one through the view controller like this:

    [viewController.navigationController setNavigationBarHidden:YES animated:YES];
    

提交回复
热议问题