1

我正在使用此代码为我的视图制作波纹动画

transition = [CATransition animation];
    transition.delegate = self;
    transition.duration = 3;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    NSString *types[4] = {@"cube", @"rippleEffect", @"cube", @"alignedCube"};
    NSString *subtypes[4] = {kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromRight};
    transition.type = types[1];
    transition.subtype = subtypes[1];

现在我想通过点击停止动画,然后我想从我停止的视图开始......

我试过了

[view.layer removeAllAnimations];

但我发现以下事情不起作用..任何建议???

4

2 回答 2

0

将动画的速度设置为 0 可暂停,设置为 1 可再次恢复。看看https://developer.apple.com/library/ios/#qa/qa2009/qa1673.html

于 2012-08-29T09:42:11.507 回答
0

您可以从 CALayer 获取当前动画状态。

   #import <QuartzCore/QuartzCore.h>

   myView.layer.modelLayer.frame = myView.layer.presentationLayer.frame;
于 2012-08-29T09:50:58.237 回答