When I create a XCode 4 iPhone template for TabBarController with storyboard, its automaticly configured with a main view controller and everything. But there is no propery for the Tab Bar Controller in the AppDelegate. Can I created an outlet for it, and tryed to link it with my Tab Bar Controller in storyboard but that's not possible. Is there a better way to access the Tab Bar Controller in didFinishLaunchingWithOptions method, as it's already kind of hooked up? What I want is self.currentController = current tab in Tab Bar Controller.
AppDelegate.h:
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
AppDelegate.m:
@interface AppDelegate()
@property (nonatomic, assign) UIViewController<SubViewContainer> *currentController;
@end
@synthesize window = _window
@synthesize currentController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//I need this piece of code to equal the Tab Bar Controller current tab
self.currentController = ?
return YES;
}
//And I'm gonna use this void for some statements about the Tab Bar Controller tabs:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:
(UIViewController *)viewController
{
// with some statements
}