Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing a Top Navigation Controller from a Subview Navigation Controller
    text
    copied!<p>I have a my views and controllers set up like so.</p> <ol> <li>A Tab/Bar controller</li> <li>Within 1. is a root view controller</li> <li>within 2. is a programmatically created navigation controller, that is displayed as a subview in the root view controller.</li> </ol> <p>What I am trying to do is access the top tab bar/navigation controller so that i can push a view onto it.</p> <p>I tried parentViewController but all it did was push the view onto the programmed nav controller.</p> <p>any suggestions?</p> <p>This is how i set up my root view controller:</p> <pre><code> -(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]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload