文章

渐变(Fade)Storyboard segue

继承 UIStoryboardSegue 类,重写 perform() 方法即可。

override func perform() {
    let transition = CATransition()
    transition.type = .fade
    transition.duration = CATransaction.animationDuration()
    source.view.window?.layer.add(transition, forKey: "kCATransition")
    source.present(destination, animated: false, completion: nil)
}

使用时在 Storyboard 中使用 Custom Segue,指定为自定义类,取消动画。

License:  CC BY 4.0