Note that there are some explanatory texts on larger screens.

plurals
  1. POiPad SplitViewController Show Popover Programatically
    primarykey
    data
    text
    <p>I have an iPad SplitViewController application in which I hide the left pane in both portrait and landscape modes. I need to show the left pane in its popover when a certain notification is received by the application. Despite experimenting with a number of different suggested solutions I am struggling to work out how to achieve this.</p> <p>I am using a MultipleMasterDetailManager implementation that includes the following code:</p> <pre><code>/* forward the message to the current detail view * all detail views must implement UISplitViewControllerDelegate */ -(void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc { self.masterBarButtonItem = barButtonItem; self.masterPopoverController = pc; barButtonItem.title = NSLocalizedString(@"Show Sidebar", @"Show Sidebar"); [self.currentDetailController.navigationItem setLeftBarButtonItem:self.masterBarButtonItem animated:YES]; } /* forward the message to the current detail view * all detail views must implement UISplitViewControllerDelegate */ -(void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem { //if (![self.currentDetailController isKindOfClass:[SyncSourceDetailViewController class]]) //{ self.masterBarButtonItem = nil; self.masterPopoverController = nil; [self.currentDetailController.navigationItem setLeftBarButtonItem:nil animated:YES]; //} } </code></pre> <p>Similar methods exist in the detail view controllers themselves.</p> <p>The method that I'm calling when the notification is received is as follows:</p> <pre><code>- (void)navigateToLatest { [self navigateToDocumentsTab]; [[self dataLoader] navigateToLatest]; // populates data for the left table view UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController; UIView *view = [[[[[splitViewController viewControllers] objectAtIndex:1] viewControllers] objectAtIndex:0] view]; [self.masterDetailManager.masterPopoverController presentPopoverFromRect:CGRectMake(0, 0, 100, 100) inView:view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } </code></pre> <p>This does not work. I've also tried using the presentPopoverFromBarButtonItem method but I cannot seem to locate the leftBarButtonItem in code.</p> <p>Maybe I am going about this completely the wrong way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload