I know I can use popoverPresentationControllerDidDismissPopover
but that is only called when the user taps outside the popover view to dismiss it.
When I dismiss the popover manually (self.dismissViewControllerAnimated(true, completion: nil)
in the popover's ViewController) nothing happens.
Popover Dismiss!
There are two ways of detecting popover dismiss:
mainViewController
, where it was actually generated, I mean ParentViewController
.Using the parentViewController
as the main generating personal
class ViewController: UIViewController, UITableViewDataSource,
UITableViewDelegate, UIPopoverPresentationControllerDelegate {
And now implementing these functions:
public func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .none
}
public func popoverPresentationControllerDidDismissPopover(_ popoverPresentationController: UIPopoverPresentationController) {
print("Popover dismisssed")
}
popOverView
made in storyboard.func dismiss() {
self.dismiss(animated: true, completion: nil)
print("DISMISSS")
}
@IBAction func cancelClicked(_ sender: Any) {
dismiss()
}
NOTE: For storyboards you can ask further details.
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