简体   繁体   English

Swift CATransition:无论如何都要删除这个动画的褪色效果?

[英]Swift CATransition: Is there anyway to remove the fading effect from this animation?

I have an animation here but when the old ViewController is pushed out of the window it fades to black and the new one fades in from black which doesn't look very nice. 我在这里有一个动画,但是当旧的ViewController被推出窗口时,它会渐变为黑色,而新的则会从黑色中消失,看起来不是很好。 Is there a way the remove this fading effect? 有没有办法消除这种褪色效果?

    let transition = CATransition()
    transition.duration = 3
    transition.type = kCATransitionPush
    transition.subtype = kCATransitionFromRight

    self.window?.layer.add(transition, forKey: kCATransition)
    self.window?.rootViewController?.present(profilePreview, 
    animated: 
    false, completion: nil)

I'm pretty new to programming in general so any help would be appreciated. 我对编程很新,所以任何帮助都会受到赞赏。

Answering my own question, the only solution I can find is this: Custom segue transition animation 回答我自己的问题,我能找到的唯一解决方案是: 自定义segue过渡动画

Credit to Hussain Shabbir 感谢Hussain Shabbir

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM