Ios 如何突然结束动画?
我正在制作一个游戏,当用户移动时,源和目标方块在动画中亮起。动画持续时间为1秒 问题是,当用户太快地点击“前进”按钮时,所有源和目标方块都会亮起,导致许多亮起方块发生,因为第二个动画在第一个动画结束之前开始 当动画的持续时间尚未结束时,如何突然结束动画 动画功能代码:-Ios 如何突然结束动画?,ios,xcode,Ios,Xcode,我正在制作一个游戏,当用户移动时,源和目标方块在动画中亮起。动画持续时间为1秒 问题是,当用户太快地点击“前进”按钮时,所有源和目标方块都会亮起,导致许多亮起方块发生,因为第二个动画在第一个动画结束之前开始 当动画的持续时间尚未结束时,如何突然结束动画 动画功能代码:- [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:value]; [UIView setAnimationRepeat
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:value];
[UIView setAnimationRepeatCount:1];
// [UIView setAnimationRepeatAutoreverses:YES];
[self.view viewWithTag:(src+1)+2000].backgroundColor=[UIColor orangeColor];
[self.view viewWithTag:(src+1)+2000].backgroundColor=[UIColor clearColor];
[self.view viewWithTag:(dest+1)+2000].backgroundColor=[UIColor orangeColor];
[self.view viewWithTag:(dest+1)+2000].backgroundColor=[UIColor clearColor];
[UIView commitAnimations];
注意:-我接受否决票作为一种健康的批评方式,但一定要写下理由,以便改进使用
#import <QuartzCore/QuartzCore.h>
.......
[myView.layer removeAllAnimations];
#导入
.......
[myView.layer RemoveAllianimations];
希望能有帮助。快乐编码:)使用
#import <QuartzCore/QuartzCore.h>
.......
[myView.layer removeAllAnimations];
#导入
.......
[myView.layer RemoveAllianimations];
希望能有帮助。快乐编码:)4分钟。。。计算能力很强:)而且还要提高投票率,以便将来能帮助人们。感谢stackoverflow所说的:)好的,@amar如果可能的话,也可以对其进行投票,这样它可以帮助其他用户搜索相同的问题,提高答案的完整性。再次感谢:)4分钟。。。计算能力很强:)而且还要提高投票率,以便将来能帮助人们。感谢stackoverflow所说的:)好的,@amar如果可能的话,也可以对其进行投票,这样它可以帮助其他用户搜索相同的问题,提高答案的完整性。再次感谢:)