I have an UISplitViewController with the master having an UIViewController embedded in an UINavigationController. A toolbar button is responsible for bringing an UIPopoverController up, via segue. Such popover controller wraps an UIViewController also embedded in an UINavigationController, called SettingsViewController.
I can get a pointer to the UIPopoverController from the UIStoryboardPopoverSegue:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(UITableViewCell *)sender
{
if ([segue.identifier isEqualToString:@"Settings"]) {
UIStoryboardPopoverSegue *popoverSegue = (UIStoryboardPopoverSegue*) segue;
SettingsViewController *settingsViewController = ... // TODO
settingsViewController.popoverController = popoverSegue.popoverController;
}
}
But I can’t find a way to get a reference to the inner SettingsViewController. I don’t want to use a static field accessible via class method, it would be a terrible workaround.
What am I missing to get it right?
Thanks for your help!
UIPopoverSegue contains a UIPopoverController
With this you can easily get the contentViewController (view displayed in the popover)
And from the content navigation controller, you get the actual view controller:
Does this solve your problem?