gpt4 book ai didi

ios - 在 presentedViewController?.dismiss 之后快速调用 popoverPresentationControllerDidDismissPopover

转载 作者:行者123 更新时间:2023-11-28 06:00:25 26 4
gpt4 key购买 nike

我创建了一个方法来关闭呈现的 View Controller ,呈现的 View Controller 确实被关闭了,但是 popoverPresentationControllerDidDismissPopover 没有被调用,我如何让它在关闭呈现的 View Controller 后调用 popoverPresentationControllerDidDismissPopover?

func dismissPresentedViewController() {
self.presentedViewController?.dismiss(animated: true, completion: nil)
popoverPresentationController?.delegate?.popoverPresentationControllerDidDismissPopover?(popoverPresentationController!)

}

func popoverPresentationControllerDidDismissPopover(_ popoverPresentationController: UIPopoverPresentationController) {
print("Here")
}

popoverPresentationControllerDidDismissPopover 没有被调用,是的,我有 UIPopoverPresentationControllerDelegate

let popupController = storyboard?.instantiateViewController(withIdentifier: "CommentsView") as! CommentsController

popupController.modalPresentationStyle = .popover
popupController.preferredContentSize = CGSize(width: 400, height: 400)
if let popoverController = popupController.popoverPresentationController {
popoverController.sourceView = (cell)
popoverController.sourceRect = (cell?.bounds)!
popoverController.permittedArrowDirections = .up
popoverController.delegate = self
}


present(popupController, animated: true, completion: nil)

最佳答案

来自 Apple's documentation ……

popoverPresentationControllerDidDismissPopover(_:)

The popover presentation controller calls this method after dismissing the popover to let you know that it is no longer onscreen. The presentation controller calls this method only in response to user actions. It does not call this method if you dismiss the popover programmatically.

关于ios - 在 presentedViewController?.dismiss 之后快速调用 popoverPresentationControllerDidDismissPopover,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50005813/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com