I have a fairly complicated issue which I will describe as good as possible.
I have an iPad App and a SplitviewController as my main view. In Portrait mode, the SplitviewController hides the Tableview to the left, so that the DetailviewController is visible only. So far so good.
The way you use this, is, from what I understand, that if I tap on a cell to the left, I replace the Detailview to the right with a new view I want to show. To this end, I use the viewControllers property.
Now to display the Popover I have a Toolbar at the top and a Menu Button to display the Popover.
Here's the thing:
I tap on a cell, and replace the DetailviewController with a new Viewcontroller. But now the Popovercontroller is gone, since it was declared in the header of the old ViewController.
The problem: When I tap on the Menu Button in port mode, the popover cant be displayed, since it is nil now, as it wasnt initiated yet.
But what I can do is: I rotate the iPad to the landscape, and rotate it back again. The popover is back, bacause in the delegate method of the splitviewcontroller the following happens:
- (void) splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
self.popoverController = pc;
}
Where does this pc come from? How can I do that myself.
If I try to re-alloc the Popovercontroller this breaks the SplitviewController and artifacts in the App appear.
I hope I explained my problem well enough.
Any ideas?