Question

I'm using the following code to perform a segue to another view controller:

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

This works fine when the destination of "BackSegue" named segue is another view controller (one of the tabs, actually) but I need to display the tabs at the bottom so transitioning directly to this view controller won't work as there will be no tabs. Is it allowed/possible to segue to a tabbar controller? Is anything wrong with this specific code or would it be something else I'm doing?

Edit 1

The TabBar controller has no .m/.h files and is never declared programmatically, but I'm pretty sure the segue is set up correctly in the storyboard to the best of my knowledge (the same way it was set up earlier directly to the other viewcontroller).

Was it helpful?

Solution

You can segue directly to a UITabBarController. Just change the segue in your storyboard. When the segue occurs, it should load the tab bar controller, and consequently the tab bar at the bottom of the screen and the first view controller's view associated with the tab bar controller.

OTHER TIPS

In order to segue to the specific tab in the tab bar controller: You need to add the selectedIndex=1

Add these lines of code for segue:

UITabBarController *loadTabBar = [self.storyboard instantiateViewControllerWithIdentifier:@"TasksAppsTabs"];
        loadTabBar.selectedIndex=1;
        [self presentViewController:loadTabBar animated:YES completion:nil];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top