Michael VEE Michael VEE - 1 year ago 40
iOS Question

NavigationBar doesn't disappear after Show Detail segue

Now I have a viewController(A) which is root view controller for Navagation Controller followed by Tab Bar Controller, I want to perform segue from it to another viewController(B), totally replace the A.

Therefore I applied show detail(replace), it worked well as what I think in other cases. However in this case, when A segued to B, the navigation bar and Tab bar still existed. Why this happened and how to solve it?

Answer Source

A navigation controller manages a stack of view controllers to provide a drill-down interface for hierarchical content. so its not an issue, that's how it should be. Refer https://developer.apple.com/reference/uikit/uinavigationcontroller,

To hide it for whole app you can do it as follow

In application:(UIApplication *)application didFinishLaunchingWithOptions: metho just add [[UINavigationBar appearance]setHidden:YES]; it will hide navigation bar for whole App.

And to Hide bottom bar of TabBarController

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"To viewController(B)"]) {
        viewControllerB *destViewController = segue.destinationViewController;     
        // Hide bottom tab bar in the detail view
        destViewController.hidesBottomBarWhenPushed = YES;
    }
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download