I managed to display popover using UIPopoverPresentationController
as the UIPopoverController
got deprecated in IOS 8, but now I want to dismiss the popover on tap of button from the popover.
How can it be dismissed?
Use presentingViewController property of the UIViewController to dismiss. Eg: To present
vc.modalPresentationStyle = UIModalPresentationPopover;
vc.preferredContentSize = aPreffferedSize;
UIPopoverPresentationController *popcontroller = vc.popoverPresentationController;
popcontroller.barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:view];
popcontroller.permittedArrowDirections = UIPopoverArrowDirectionAny;
popcontroller.delegate = self;
[self presentViewController:vc animated:YES completion:nil];
To dismiss programatically,
[[vc presentingViewController] dismissViewControllerAnimated:YES completion:NULL];
Hope this helps.
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