I am using ARC and Storyboard in my iphone application. I have simple input text view with button, On clicking button I am implementing presentModalvuewcontroller to a mainview with Tabbarcontroller. It is working fine. Now I need to conditionally implement setSelectedIndex:1 to tabbarcontroller Here is the code I am using:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
ViewController *viewCon = (ViewController*)[storyboard instantiateViewControllerWithIdentifier:@"MainTab"];
viewCon.tabBarController.selectedIndex= 1;
[self presentModalViewController:viewCon animated:YES];
It is working properly.Just not changing the tab. It is displaying on default 0 tab.