self.navigationController value gets null in Tabbar VIew
I have a navigation controller as the root view c开发者_高级运维ontroller. I have a UIView then a UITableView, then again a UITableView, then a TabbarView and each of my tabbarview is a hierarchy of views. Now my problem is that I am able to get the value of self.navigationcontroller till the last UITableView but the value gets null in the TabbarView. Now is there a way I can access the value in the Tabbarview. Do I have to create a new navigation controller for each tabs in the tabbarview and then assign the root navigation controller value to it?
My below code does not work, The last controller where I can get the value of the navigationController is AssignmentViewController.
Code from AssignmentViewController:
- (void)viewDidLoad {
UITransTabViewController *transtvController = [[UITransTabViewController alloc] initWithNibName:@"TransTabViewController" bundle:nil];
self.transtabViewController = transtvController;
transtvController.naviController=self.navigationController;
[transtvController release];
}
In my UITranTabViewController.h I have the below code,
@interface UITransTabViewController : UIViewController <UITabBarDelegate> {
NSArray *viewControllers;
IBOutlet UITabBar *tabBar;
IBOutlet UITabBarItem *arrivalsTabBarItem;
IBOutlet UITabBarItem *departuresTabBarItem;
UIViewController *selectedViewController;
UINavigationController *naviController;
}
@property (nonatomic, retain) NSArray *viewControllers;
@property (nonatomic, retain) IBOutlet UITabBar *tabBar;
@property (nonatomic, retain) IBOutlet UITabBarItem *arrivalsTabBarItem;
@property (nonatomic, retain) IBOutlet UITabBarItem *departuresTabBarItem;
@property (nonatomic, retain) UIViewController *selectedViewController;
@property (nonatomic, retain) IBOutlet UINavigationController *naviController;
I am trying to set the value of naviController from the AssignmentViewController, but still I get the
NSLog(@"MY NAV CONTROLLER IN TRANSTABVIEWCONTROLLER IS = %@", self.naviController);
value as NULL.
精彩评论