0
運行下面的動畫。試着發送[upwardView.layer removeAllAnimations];
With IBAction
button
。如果任何人都可以爲另一個noob打開一些光。無法停止以下KeyFrameAnimation:
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"];
嘿Arun代碼完全按照您的指示運行,只要它在動畫方法中即可。我不知道如何在IBAction中調用這個。對於noobness抱歉。 – Subsonique