How can "perform selector" to the parentviewcontroller of the uipopovercontroller? I have uipopovercontroller lanuched from uiviewcontroller, and this uipopovercontroller includes other uiviewcontroller. I can't seem to reach the parent view controller from either the popover or the "internal" view controller.
I hope i'm being clear...
BTW - parentViewcontroller doesn't work...
Thanks!
There's no way to do this directly with UIPopoverController
. You're going to have to probably pass a reference to your parent view controller to the view controller you're managing with a popover controller:
// Assumes these calls are made from within a view controller and that
// MyViewController has a property called previousViewController
MyViewController * myViewController = [[[MyViewController alloc] init] autorelease];
myViewController.previousViewController = self;
UIPopoverController * popoverController = [[[UIPopoverController alloc]
initWithContentViewController:myViewController] autorelease];
UIBarButtonItem * rightBarButtonItem = self.navigationItem.rightBarButtonItem;
[popoverController presentPopoverFromBarButtonItem:rightBarButtonItem
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
Something like that, but the important point is that your view controller (managed by the popover controller) has to grab a reference to your parent view controller before you present the popover.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With