gpt4 book ai didi

iphone - 在animationDidStop中,animation的地址与我添加到图层的动画的地址不同?

转载 作者:行者123 更新时间:2023-11-29 04:15:43 25 4
gpt4 key购买 nike

这样的代码:我在 View Controller 中存储了3个动画,但是当调用 - (void)animationDidStop:(CAAnimation *)anim finish:(BOOL)flag 时,我发现 anim 的地址与任何动画的地址都不一样其中,为什么?

- (void) redoAni
{
circleHalfCaloryMask.alpha = 1;
circleHalfTimeMask.alpha = 1;
circleHalfStopWatchMask.alpha = 1;


//[circleHalfCalory removeFromSuperview];
//circleHalfCalory.alpha = 0;
[circleHalfCaloryMask.layer addAnimation:rotate3 forKey:@"rotate3"];
[circleHalfStopWatchMask.layer addAnimation:rotate2 forKey:@"rotate2"];
[circleHalfTimeMask.layer addAnimation:rotate1 forKey:@"rotate1"];
}



- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
if (anim == rotate1)
{
circleHalfTimeMask.alpha = 0;
}
else if (anim == rotate2)
{
circleHalfStopWatchMask.alpha = 0;
}
else if (anim == rotate3)
{
circleHalfCaloryMask.alpha = 0;
}
else
{
}
}

在 gdb 中:

rotate1 CABasicAnimation *  0x07297280
rotate2 CABasicAnimation * 0x072899a0
rotate3 CABasicAnimation * 0x07297d40
anim CABasicAnimation * 0x07285010

最佳答案

文档说:

  • (void)addAnimation:(CAAnimation *)anim forKey:(NSString *)key

anim

The animation to be added to the render tree. Note that the object iscopied by the render tree, not referenced. Any subsequentmodifications to the object will not be propagated into the rendertree.

关于iphone - 在animationDidStop中,animation的地址与我添加到图层的动画的地址不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13758646/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com