2015-10-02 79 views

回答

0

这里是值得信赖的文章:https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Animation_Types_Timing/Articles/Timing.html 您将不得不处理CAAnimation,而不仅仅是UIView

更新: 由于PO没能成功,到目前为止,有什么可以去错了一些捕捞: 一)确保你的动画被创建并添加类似如下:

CABasicAnimation* fadeAnim = [CABasicAnimation animationWithKeyPath:@"opacity"]; 
fadeAnim.fromValue = [NSNumber numberWithFloat:1.0]; 
fadeAnim.toValue = [NSNumber numberWithFloat:0.0]; 
fadeAnim.duration = 1.0; 
[theLayer addAnimation:fadeAnim forKey:@"opacity"]; 

// Change the actual data value in the layer to the final value. 
theLayer.opacity = 0.0; 

有关详细信息,请参阅:https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/CreatingBasicAnimations/CreatingBasicAnimations.html

b)如果您使用animateTransition:确保

所有动画都必须在transitionContext的 containerView属性指定的视图中进行。

(访问https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewControllerAnimatedTransitioning_Protocol/#//apple_ref/occ/intfm/UIViewControllerAnimatedTransitioning/animateTransition:供参考)。希望这会帮助你将所有问题分类。

+0

是的,我也得出了这个结论。但是,我将我的CABasicAnimations添加到animateTransition中的图层中,并且它没有运行它们! – bandejapaisa

+0

请参阅我的答案更新 - 我描述了您的问题的一些可能的原因。 –

+0

谢谢。 b点看起来像一个有趣的笔记。我会进一步研究。 – bandejapaisa