Reputation: 8077
I've got a Tab Controller with a navigation controller which has a view, as seen in the image below:
I need to retrieve the Switches Controller from within my AppDelegate so I can do some things with it at runtime.
I believe I can retrieve the NavigationController itself by doing this:
UINavigationController *navController = [tabBarController.viewControllers objectAtIndex:0];
Not really sure how to access my SwitchesController from there though. Any suggestions?
Upvotes: 0
Views: 219
Reputation: 38728
Why not make an ivar with an IBOutlet
? It's probably the most flexible solution as you can now change the ordering of your viewController's without breaking your build.
Upvotes: 1
Reputation:
Use one of the visibleViewController, topViewController
properties of UINaviationController, or call:
[navigationController.viewControllers objectAtIndex:index];
Hope it helps.
Upvotes: 0