如何在CATransition中删除淡化动画

时间:2016-04-18 03:56:46

标签: ios swift animation catransition

我尝试通过将视图的背景颜色更改为clearcolor 删除FadeIn / Out来删除两个视图之间的淡化动画

 self.navigationController!.view.layer.removeAnimationForKey("FadeIn")
 self.navigationController!.view.layer.removeAnimationForKey("FadeOut")
根据以下答案

Anyway to remove fade when using CATransition between 2 views?

仍然会获得淡入淡出动画。以下是我的代码。

let transition: CATransition = CATransition()
transition.duration = 1
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionDefault)
transition.type = kCATransitionPush
transition.subtype = kCATransitionFromRight      
self.navigationController!.view.layer.removeAnimationForKey("FadeIn")                 
self.navigationController!.view.layer.removeAnimationForKey("FadeOut")
self.navigationController!.view.layer.addAnimation(transition, forKey: kCATransition)
self.navigationController!.popViewControllerAnimated(false)

0 个答案:

没有答案