Reputation: 196
I have a view with 3 buttons and a tabbar controller that contains 3 views. I am using the storyboard. I want go from my view to a specific view from the tabbar controller. When I create a segway to the destination view, the tabbar is not included.
The only way I find out is to create a segway to the tabbar controller itself, but then by default the first view is been shown.
Thanks in advance!
Upvotes: 2
Views: 3160
Reputation: 196
Yess!! I got the solution. Do the following:
In you're .h file:
@property (strong, nonatomic) UITabBarController *tabController;
In you're .m file:
@synthesize tabController;
tabController = [self.storyboard instantiateViewControllerWithIdentifier:@"tabbar"];
The selected index is the tab you want to go
tabController.selectedIndex = 1;
[[self navigationController] pushViewController:tabController animated:YES];
Upvotes: 8