2

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.

deshiknaves
  • 33
  • 1
  • 5
  • 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. – deshiknaves Jul 11 '12 at 02:17
  • I'll post that as an answer when I am able to in 3 hours. – deshiknaves Jul 11 '12 at 02:18

3 Answers3

2

you have to dismiss your popovercontroller. see this answer, there is a code example:
https://stackoverflow.com/a/5829368/558150

Community
  • 1
  • 1
brush51
  • 5,691
  • 6
  • 39
  • 73
1

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

deshiknaves
  • 33
  • 1
  • 5
0

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;
gjpc
  • 1,428
  • 14
  • 21