When using hidesBottomBarWhenPushed, i want the tab bar to reappear when i push another view

前端 未结 6 1209
南方客
南方客 2020-12-06 11:09

I have a navigation controller. For one of the views i want to hide the bottom tab bar, so it gets the max possible screen real estate. To do this, i have:

-         


        
6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 11:55

    As of iOS5, there's a very easy means of accomplishing this. It's essentially the same method as Deepak, but there aren't any artifacts with the animation - everything looks as expected.

    On init, set

    self.hidesBottomBarWhenPushed = YES;
    

    just as you have above. When it's time to push the new controller on the stack, it's as simple as:

    self.hidesBottomBarWhenPushed = NO;
    
    UIViewController *controller = [[[BBListingController alloc] init] autorelease];
    [self.navigationController pushViewController:controller];
    
    self.hidesBottomBarWhenPushed = YES;
    

    It's important to reset the value to YES after the controller has been pushed in order to re-hide the bar when the user taps the Back button and the view comes back into view.

提交回复
热议问题