I'm trying to access it in my AppDelegate by doing this Course *rootController = (Course *)[navigationController tabcontroller];
but it won't work doesnt seem to get the "Course" root controller.
Thanks
I'm trying to access it in my AppDelegate by doing this Course *rootController = (Course *)[navigationController tabcontroller];
but it won't work doesnt seem to get the "Course" root controller.
Thanks
It is not clear from your question how you have your views arranged and what you are trying to achieve. Usually a UITabBarController contains an array of root view controllers. Each view controller corresponding to a tab on the tab bar. Any or all of those view controllers could be a UINavigationController which itself can contain a stack of view controllers.
UITabBarController
|-UINavigationController -> [AViewController,.....]
|-UINavigationController -> [AnotherViewController,.....]
|-UINavigationController -> [AndAnotherViewController,.....]
The navigation controllers which in this case would be the root view controller for each tab can be accessed via the UITabBarController viewControllers property:
NSArray *rootViewControllers = [tabBarController viewControllers];
So if you want the root view controller of the first tab bar:
UINavigationController *rootViewController = [rootViewControllers objectAtIndex:0];