I’ve a UISplitViewControllerDelegate, which is receiving the UIBarButtonItem and UIPopoverController when the UISplitViewController in rotated to landscape orientation. The following delegating method is implemented:
- (void)splitViewController:(UISplitViewController *)svc
willHideViewController:(UIViewController *)aViewController
withBarButtonItem:(UIBarButtonItem *)barButtonItem
forPopoverController:(UIPopoverController *)pc
{
barButtonItem.title = self.title;
myViewController.splitViewBarButtonItem = barButtonItem;
myViewController.splitViewPopoverController = pc;
}
When myViewController is setting the barButtonItem it is placed in the leftBarButtonItem in the view’s navigation bar.
My problem is, that myViewController has another popover, which should be dismissed, when the leftBarButtonItem is tapped. It is not a problem to dismiss the other popover, but the problem is, that I do not know, when the barButtonItem is clicked.
How can I accomplish this?
I found a solution using the
splitViewController:popoverController:willPresentViewController:method.The
dismissPopoversmethod in myViewController is implemented to hide popovers if they are presented.