I have the following setup:
SplitViewController
as rootController.
Detail part is first
ViewController
with View
> ContainerView
(later, View
will have ImageView
, but that is not the issue here).
The ContainerView
has segue (embed) to another view controller (NavigationController
).
This is graphically represented in IB as:
Now the thing is I want to access the NavigationController
from rootController (eg SplitViewController
). I was unable to navigate down the hierarchy of "subViews" and so.
Is there some convenient way to get hold of the NavigationController
?
Without the ViewController
(together with ContainerView), I was able to access it like:
UISplitViewController *splitViewController = (UISplitViewController *) self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
// now i have the controller, i can delegate to it or use it in any other way:
splitViewController.delegate = (id) navigationController.topViewController;