简体   繁体   中英

Displaying a UITabBar when pushing to a UIViewController

I am working on a new project of mine and am looking for what the best solution to keep the UITabBarController displaying even when using a segue to push to a UIViewController .

Currently I have an Initiation of our UITabBarController on app launch, which contains multiple viewcontroller relationships . Particularly the initial view controller option is a custom UIViewController which implements a UITableView . Once a cell is selected I call a show(push) segue to another UIViewController . This is where I lose my TabBar which is as expected. Now I have tried different approaches such as setting the hidden value of our tabbar to YES , but does not seem to help.


Code

When Cell Selected:

   [self performSegueWithIdentifier: @"tableCellOptions" sender: self];

When preparing for segue :

   if([segue.identifier isEqualToString:@"tableCellOptions"]) {

        additionUITableView *move = (additionUITableView *) segue.destinationViewController;
        move.thisOption = [menuOptions objectAtIndex:cellPushed];
    }

What would your approach be to this and why?

If you have Tab bar controller as the initial View Controller, the tab bar will show by default on each view controller. If you are using storyboard or xib file, then select the tab bar item in view controller and check its properties, and make sure "hide tab bar on push" is unchecked.

Programmatically you can do this,

self.hidesBottomBarWhenPushed = NO;

[self.navigationController pushViewController:viewControllerToPush animated:YES];

Place it in viewDidLoad or viewDidAppear.

I hope this solves your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM