Ios 如果modalPresentationStyle设置为.custom,UIKit将在视图控制器演示期间使用什么动画
例如,我有一个自定义转换委托,只实现了一个方法:Ios 如果modalPresentationStyle设置为.custom,UIKit将在视图控制器演示期间使用什么动画,ios,swift,uikit,transition,Ios,Swift,Uikit,Transition,例如,我有一个自定义转换委托,只实现了一个方法: class CustomTransition: NSObject, UIViewControllerTransitioningDelegate { func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresent
class CustomTransition: NSObject, UIViewControllerTransitioningDelegate {
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
let presentationController = CustomTransitionPresentationController(presentedViewController: presented, presenting: presenting)
return presentationController
}
}
然后只设置视图控制器的modalPresentationStyle=.custom
,并且transitioningDelegate=ourcustomTransitionwithout anyanimator
那么将使用哪种类型的动画呢?除非您在viewcontroller中没有任何动画师的情况下指定委托以符合我们的CustomTransition,否则它将属于以下情况: 它将使用符合UIViewControllerTransitioningDelegate的presentingViewController,并返回自己的自定义演示动画 与您的情况一样,它返回:CustomTransitionPresentationController
- 您的CustomTransitionPresentationController可能符合UIViewControllerAnimatedTransitioning,并具有以下自定义方法:
- 或UIPresentationController的子类