2

I have a SplitviewController with multiple possible Detailviews (Webviews, Tableviews, regular UIViews).

As an example, I have a NavigationController on top, then navigate through some tables.

Finally I show some Content, lets say a UIWebview. I rotate the iPad to portrait, and in the toolbar I add a Button from which the popOverController is displayed.

On Buttonclick I say:

if (!popoverController) {

if (self.view.window != nil) {
popoverController = [[UIPopoverController alloc] initWithContentViewController:  [appDelegateiPad naviPad]];

popoverController.delegate = self;

 }
}

Here, I instantiate a PopOverController and the Content is the left part of the splitview, from the point I left off. All is nice.

But when I rotate, I get this warning:

CoreAnimation: ignoring exception: Popovers cannot be presented from a view which does not have a window.

And on the screen the popOverController reappears with empty content (black translucent I would say) but I don't know why, since I dismissed it and there cant be another instance since I only create one on buttonclick.

This has been driving me crazy for days.

ANY(!) help is appreciated!

-(void) showPopOver:(id) sender {




NSLog(@"showing popover?");

if (!popoverController) {

    if (self.view.window != nil) {
        popoverController = [[UIPopoverController alloc] initWithContentViewController:[appDelegateiPad naviPad]];
        //RootViewController *r = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle: nil];
        //  popoverController = [[UIPopoverController alloc] initWithContentViewController:r];
        //popoverController.popoverContentSize = CGSizeMake(320, 800);
        //popoverController.delegate = self;
    }
 }


if (![popoverController isPopoverVisible]) {


    [popoverController presentPopoverFromBarButtonItem:barButton3 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    //[popoverController presentPopoverFromRect:CGRectMake(10, 10, 20, 20) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];        

}
else {
    [popoverController dismissPopoverAnimated:NO];
}


}
Diosney
  • 10,520
  • 15
  • 66
  • 111
Icky
  • 1,055
  • 1
  • 12
  • 30
  • I believe that more relevant than the initialization is the presentation. Can you show some code on when you present the popover? Meaning when you call [popoverController presentPopoverFrom ....]; – fsaint Jan 23 '11 at 16:12
  • I added some code. I really need help on this one. Note: the code is in my webview, it makes a new popOver and I am wondering if that is correct? I did this: I set a new detailviewcontroller to my splitviewcontroller (i.e. the webviewcontroller) - is that right? – Icky Jan 23 '11 at 17:39
  • Did you get around this ? I am facing a similar problem. http://stackoverflow.com/questions/5014479/require-uisplitviewcontroller-to-lazy-load-the-view-controllers-for-detail-view-c – Viraj Mar 10 '11 at 06:11
  • Yes, you must never ever replace the Navigation Controller with a new insance.... this will mess up the Splitview Controller. SplitviewController is buggy... – Icky Mar 10 '11 at 09:59
  • Can you have a shot at my question which I mentioned before ? We could discuss it there. Appreciate your help. – Viraj Mar 14 '11 at 07:54

0 Answers0