自定义 UIModalPresentationStyle.custom:为什么调用 presentationController(forPresented 而不是 animationController(forPresented?

Custom UIModalPresentationStyle.custom: Why does presentationController(forPresented get called but not animationController(forPresented?

我正在使用 UIModalPresentationStyle.custom

在我的 UIViewControllerTransitioningDelegate 为什么会调用此方法:

func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController?

但是 none 个函数被调用:

func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning?

func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning?

func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning?

func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning?

确保在调用

时将 animated Bool 设置为 true
present(viewController, animated: true, completion: nil)

dismiss(animated: true, completion: nil)