// 返回负责转场的控制器对象 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
新闻热点
疑难解答