views:

55

answers:

2

I have a UITabBarController that is being presented modally from a RootViewController:

stvTabBarController = [[UITabBarController alloc] init];
stvTabBarController.delegate = self;
stvTabBarController.viewControllers = [NSArray arrayWithObjects:stvNavController, scheduleNavController, nil];
stvTabBarController.selectedViewController = stvNavController;

[self presentModalViewController:stvTabBarController animated:YES];

How can I switch tabs from stvNavController? I can't do:

self.tabBarController.selectedIndex = 3;

because I don't have a reference to the tabBarController in the stvNavController.

A: 

Check the value of stvNavController's parentViewController property—it should be a reference to the tab bar controller.

Noah Witherspoon
A: 

As I see in your code there are only 2 view controllers under the tab controller.

You are trying to select the fourth one...

Michael Kessler