[UIView addKeyframeWithRelativeStartTime
但是,我想easeIn关键帧中的一个有3个动画部分。
我该如何添加一个缓动功能呢?
[UIView addKeyframeWithRelativeStartTime
但是,我想easeIn关键帧中的一个有3个动画部分。
我该如何添加一个缓动功能呢?
这里是值得信赖的文章: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;
b)如果您使用animateTransition:
,确保:
所有动画都必须在transitionContext的 containerView属性指定的视图中进行。
(访问https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewControllerAnimatedTransitioning_Protocol/#//apple_ref/occ/intfm/UIViewControllerAnimatedTransitioning/animateTransition:供参考)。希望这会帮助你将所有问题分类。
是的,我也得出了这个结论。但是,我将我的CABasicAnimations添加到animateTransition中的图层中,并且它没有运行它们! – bandejapaisa
请参阅我的答案更新 - 我描述了您的问题的一些可能的原因。 –
谢谢。 b点看起来像一个有趣的笔记。我会进一步研究。 – bandejapaisa