gpt4 book ai didi

ios - 停止以下 KeyFrameAnimation 时遇到问题 :

转载 作者:行者123 更新时间:2023-11-29 01:17:12 27 4
gpt4 key购买 nike

运行下面的动画。尝试发送 [upwardView.layer removeAllAnimations]; 使用 IBAction button。如果有人能为另一个菜鸟提供一些启示。

 UIView* upwardView=[[UIView alloc]init];
[upwardView setFrame:CGRectMake(10, 175, 86, 140)];
[self.view addSubview:upwardView];
[self.stageView addSubview:upwardView];

NSArray *animationImages=[NSArray arrayWithObjects:

[UIImage imageNamed:@"win_1.png"],
[UIImage imageNamed:@"win_2.png"],
[UIImage imageNamed:@"win_3.png"],
[UIImage imageNamed:@"win_4.png"],
[UIImage imageNamed:@"win_5.png"],
[UIImage imageNamed:@"win_6.png"],
[UIImage imageNamed:@"win_7.png"],
[UIImage imageNamed:@"win_8.png"],
[UIImage imageNamed:@"win_9.png"],
[UIImage imageNamed:@"win_10.png"],
[UIImage imageNamed:@"win_11.png"],
[UIImage imageNamed:@"win_12.png"],
[UIImage imageNamed:@"win_13.png"],
[UIImage imageNamed:@"win_14.png"],
[UIImage imageNamed:@"win_15.png"],nil];

CAKeyframeAnimation *animationSequence = [CAKeyframeAnimation animationWithKeyPath: @"contents"];
animationSequence.calculationMode = kCAAnimationLinear;
animationSequence.autoreverses = NO;
animationSequence.duration = 0.90;
animationSequence.repeatCount = HUGE_VALF;
animationSequence.beginTime = 0;



NSMutableArray *animationSequenceArray = [[NSMutableArray alloc] init];
for (UIImage *image in animationImages)
{
[animationSequenceArray addObject:(id)image.CGImage];
}
CALayer *layer = [upwardView layer];
animationSequence.values = animationSequenceArray;
[layer addAnimation:animationSequence forKey:@"contents"];

最佳答案

为什么要将 upwardView 添加到 self.view 和 self.stageView 中?删除这个

[self.stageView addSubview:upwardView];

行。它应该可以完美运行。

关于ios - 停止以下 KeyFrameAnimation 时遇到问题 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35028487/

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