Reputation:
i want to get the value from the presented popover. I googled around and got this answer
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
{
YourViewController *controller = popoverController.contentViewController;
MyData *data = controller.yourData;
//Do something with data
}
But i have used UIPopOverPresentationController. So how am i going to get the value from these delegate method perhapsly
func popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) {
// var controller = popoverPresentationController.
}
OR Should i create delegate to pass data back to main View Controller ?
Upvotes: 1
Views: 1885
Reputation: 3648
Take a look at the documentation of UIPopoverPresentationController
, it inherits from UIPresentationController
.
It has the properties presentingViewController
and presentedViewController
. One of which should reference the controller you want to access and pass data to/get data from:
func popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) {
let controller = popoverPresentationController.presentedViewController
// Fetch data from the presented controller
}
Upvotes: 6