Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如果modalPresentationStyle设置为.custom,UIKit将在视图控制器演示期间使用什么动画_Ios_Swift_Uikit_Transition - Fatal编程技术网

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,并具有以下自定义方法:
func transitionDuration(transitionContext:UIViewControllerContextTransitioning?->NSTimeInterval{}

func animateTransition(transitionContext:UIViewControllerContextTransitioning){}

  • 或UIPresentationController的子类