我有一个像这样设置的视图和控制器。
- 一个标签/栏控制器
- 1.内是一个根视图控制器
- 2. 内是一个以编程方式创建的导航控制器,在根视图控制器中显示为子视图。
我想要做的是访问顶部标签栏/导航控制器,以便我可以将视图推送到它上面。
我尝试了 parentViewController 但它所做的只是将视图推送到编程的导航控制器上。
有什么建议么?
这就是我设置根视图控制器的方式:
-(void)viewDidAppear:(BOOL)animated{
NSLog(@"ROOT APPEARED");
[super viewDidAppear:animated];
WorklistViewController *worklistController = [[WorklistViewController alloc]initWithNibName:@"WorklistView" bundle:[NSBundle mainBundle]];
UINavigationController *worklistNavController = [[UINavigationController alloc] initWithRootViewController:worklistController];
worklistNavController.navigationBar.barStyle = UIBarStyleBlackOpaque;
worklistNavController.view.frame = watchlistView.frame;
[worklistNavController.topViewController viewDidLoad];
[worklistNavController.topViewController viewWillAppear:YES];
[self.view addSubview:worklistNavController.view];
GetAlertRequestViewController *alertsController = [[GetAlertRequestViewController alloc]initWithNibName:@"AlertsView" bundle:[NSBundle mainBundle]];
UINavigationController *alertsNavController = [[UINavigationController alloc] initWithRootViewController:alertsController];
alertsNavController.navigationBar.barStyle = UIBarStyleBlackOpaque;
alertsNavController.view.frame = alertsView.frame;
[alertsNavController.topViewController viewDidLoad];
[alertsNavController.topViewController viewWillAppear:YES];
[self.view addSubview:alertsNavController.view];
}