问题
I am trying to hide the master view controller when a selection has been made in the table view. I've looked all over stackoverflow and can only find solutions that used to work prior to iOS 5.1
I've tried to dismissPopoverAnimated or dismissModalViewControllerAnimated, but none of those seem to work.
There has got to be a way to hide the masterview controller once a section has been made.
Any help would be really appreciated. Thanks.
回答1:
you have to dismiss your popovercontroller
. see this answer, there is a code example:
https://stackoverflow.com/a/5829368/558150
回答2:
Actually I figured it out after a lot of playing around What I did was save 'pc' in a
UIPopoverController * popOver in: - (void) splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc;
then used:
[[[self.splitViewController.viewControllers lastObject] popOver] dismissPopoverAnimated:YES];
There might be a better way to do this, but it works as expected
回答3:
The IOS 6.0 SplitView template makes this easy, simply set the detailItem and the popover disappears if appropriate. There is even a check if you are using the same detaiItem so no page setup and refresh work gets done.
self.detailViewController.detailItem = self.detailViewController.detailItem;
来源:https://stackoverflow.com/questions/11422812/how-can-i-dismiss-the-master-view-from-a-uisplitviewcontroller-in-ios-5-1