I am making an iOS app where I have Tab bar + Side Menu.
Tab bar have 5 items and side menu have around 12 menus.
All side menu functionalities are from Tab 1 & side menu is accessible across all views in tab bar.
That means if I am on Tab 2, even I can access side menu. When I click on side menu item from Tab 1, I will go to Tab 1 and then navigation will occur.
What I want to do is let's say if I click on Complains menu from side menu, I want to go to ComplainsViewController.
Code I used is as below.
// go to first tab
self.tabBarController.selectedIndex = 0;
// now navigate
ComplainsViewController *sViewCon = [self.storyboard instantiateViewControllerWithIdentifier:@"Complains"];
CATransition *transition = [CATransition animation];
transition.duration = 0.5;
transition.type = kCATransitionFade;
[self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
[self.navigationController pushViewController:sViewCon animated:NO];
I have two scenario.
Scenario 1 (Correct)
I am on Tab 1 and click on Complains from side menu. When I click, I go successfully to ComplainsViewController using above code.
Scenario 2 (In-Correct)
I am on Tab 2 and click on Complains from side menu. When I click, I go successfully to Tab 1, but I don't navigate to ComplainsViewController. When I click back to Tab 2, I see ComplainsViewController open in Tab 2.
Any idea how to switch first to Tab and then navigate to another viewcontroller?
Edit 1
Below is the basic structure I have.

[[self navigationController] popToRootViewControllerAnimated:NO];