0

I think I've spent 3 days trying various people's online solutions to make a popover appear and work and literally not a single example has worked.

But here is my current code. Can someone tell me why my popover is not appearing? Thanks.

popper = [[Popper alloc] initWithNibName: @"Popper" bundle: nil];
navigationController = [[UINavigationController alloc] initWithRootViewController: popper];
[navigationController presentModalViewController: popper animated:YES];
[navigationController release];
[popper release];

Notes:

  • My Popper class inherits from UIViewController.
  • I have set my Xib's class to Popper in IB.
  • I have set my main view controller to use UIPopoverControllerDelegate.
1
  • Not sure, but I usually create a property for the modals. This could be preventing it from acting properly. Try that. Jul 25, 2011 at 12:12

4 Answers 4

0

So have you added the navigationController to your view?

why not do:

[self presentModalViewController: popper animated:YES];
1
  • Hi, thanks that helps although for some reason my Xib's dimensions are being ignored and an entire 768x1024 window is sliding up on top of my main view.
    – MrPopper
    Jul 25, 2011 at 23:07
0

When you already initialise the navigation controller with a view all you need to do is add the navigation controller to your view.

[self.view addSubView: navigationController.view];

Dont present it as modal.

0

UIPopoverController is only available on the iPad, and since you've tagged your question with iPhone I'm assuming this may well be the issue.

1
  • I am coding for iPad actually. Oops.
    – MrPopper
    Jul 25, 2011 at 23:29
0

For custom popovers, I recommend WEPopover

http://iosdevelopertips.com/open-source/ios-open-source-popover-api-for-iphone-wepopover.html

Just attach the view controller to the wepopovercontroller and you are done.

    WEPopoverController *popOver = [[WEPopoverController alloc] initWithContentViewController:saveViewController];

    [popOver presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    [saveViewControlle release];
1
  • if you use your custom pop over, as you mentioned, the model view controllers occupy whole screen.
    – Hanuman
    Jul 25, 2011 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.