When you add the NavigationController, you could pass it upwards (delegate methods) to your subclass of UISplitViewController and store a reference there.
You could add a @property (MySplitViewController *) delegate;
your MyContentView and set it to the splitviewcontroller. When the segue is fired, you could then do the following:
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"ShowNavigationController"])
{
UINavigationController *controller = segue.destinationViewController;
[self.delegate setNavigationController:controller];
}
}
Edit: If you want to stick to your code, you could do something like this:
UISplitViewController *splitViewController = (UISplitViewController *) self.window.rootViewController;
UIViewController *container = [splitViewController.viewControllers lastObject];
UINavigationController *navigationController = [container.childViewControllers lastObject];
splitViewController.delegate = (id) navigationController.topViewController;
In that case you should really include some error handling.