标签:
// 返回负责转场的控制器对象 func presentationControllerForPresentedViewController(presented: UIViewController, presentingViewController presenting: UIViewController, sourceViewController source: UIViewController) -> UIPresentationController? { return PopoverPresentationController(presentedViewController: presented, presentingViewController: presenting) } // 返回提供modal动画的对象 func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? { isPresented = true return self } // 返回提供dismiss动画的对象 func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { isPresented = false return self } // 动画时长 func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval { return 1.2 } // 转场动画实现函数 func animateTransition(transitionContext: UIViewControllerContextTransitioning) { }
// 设置转场动画代理 vc.transitioningDelegate = self // 将转场动画设置为自定义 vc.modalPresentationStyle = UIModalPresentationStyle.Custom
标签:
原文地址:http://www.cnblogs.com/FrankieZ/p/4610153.html