Question

I am using TabBarController with two tabs one is InputViewController and another tab is TableViewController. In this both viewController allocated in appDelegate file and added TabBarController. Now not able to get TableViewController instance in InputViewController for passing textfield value. how to get instance TabBarController instance in first tab InputViewController

Was it helpful?

Solution

You can access a instance of item (viewController,navigationController) that you assigned on a tab of UITabBarController like it -

NSArray *views = [self.tabBarController viewControllers];

Getting First Tab instance -

FirstViewController *fvc = (FirstViewController*) [views objectAtIndex:0];

You can get any tab's viewController instance by using above code. Just change the index.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top