hidesBottomBarWhenPushed = NO not working?

后端 未结 9 1449
南笙
南笙 2020-12-08 14:56

I have a UITabBar in my app, which I\'m hiding on the first UIViewController in the first tab by putting this line in the AppDelegate

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 15:27

    This is what the documentation for hidesBottomBarWhenPushed says (emphasis added):

    If YES, the bottom bar remains hidden until the view controller is popped from the stack.

    So it looks like the behavior you're seeing is just what the documentation says will happen. You start by pushing a view controller onto the stack which has hidesBottomBarWhenPushed = YES. At that point, pushing other view controllers onto the stack won't change the hiddenness of the bottom bar. As long as that first view controller is on the stack, the bottom bar will remain hidden.

    So I think you'll have to come up with a different way of accomplishing your UI goal. One option would be to present the first view controller as a modal view controller over the tab bar controller's view. Then, when you want to go to the second view controller just dismiss the first one and voila. The only visual difference will be the transition animation.

    There are surely other options too, but that just came first to my mind.

    Good luck!

提交回复
热议问题