Search code examples
iosuitabbaruitoolbarpushviewcontroller

iOS push BottomBar and ToolBar simultaneously


I have an UITableView with TabBar (BottomBar) and ToolBar. When selecting a cell the detailsView is push to the stack. The detailsView does not have a TabBar nor a ToolBar. This is done within the prepareForSegue method:

...
if ([segue.identifier isEqualToString:@"ShowDetails"])
{
    ...
    editDetailsViewController.hidesBottomBarWhenPushed = YES;    // for hiding the TabBar
    [self.navigationController setToolbarHidden:YES];   // for hiding the toolbar
}

Now everything work fine but when the cell is selected the ToolBar is switched off immediately in the table view immediately before the detailsView is shown. How do I prevent that behavior? The ToolBar and TabBar should move together without switching off either of them?

Thanks!


Solution

  • This part is fine:

    ...
    if ([segue.identifier isEqualToString:@"ShowDetails"])
    {
        ...
        editDetailsViewController.hidesBottomBarWhenPushed = YES;    // for hiding the TabBar
    }
    

    However, prepareForSegue is called before the push.

    If you want the toolbar to hide with an animation you should implement a Custom UISegue and animate the UIToolbar in the transition.