这是我的代码:
- (void)showother{
backgroundA.alpha = 1.0;
backgroundB.alpha = 0.0;
[UIView beginAnimations:@"ken" context:NULL];
[UIView setAnimationDuration:4];
[UIView setAnimationDelegate:self];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDidStopSelector:@selector(showHideDidStop)];
CGAffineTransform rotate = CGAffineTransformMakeRotation(0.00);
CGAffineTransform moveLeft = CGAffineTransformMakeTranslation(0.9,0.9);
CGAffineTransform combo1 = CGAffineTransformConcat(rotate, moveLeft);
CGAffineTransform zoomOut = CGAffineTransformMakeScale(1.5,1.5);
CGAffineTransform transform = CGAffineTransformConcat(zoomOut, combo1);
backgroundA.transform = transform;
[UIView commitAnimations];
}
- (void)showHideDidStop{
[UIView beginAnimations:@"fade" context:NULL];
[UIView setAnimationDuration:4];
backgroundA.alpha = 0.0;
backgroundB.alpha = 1.0;
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(showother)];
[UIView commitAnimations];
backgroundA.image = [backgroundImageQueue objectAtIndex:0];
backgroundB.image = [backgroundImageQueue objectAtIndex:[backgroundImageQueue count] - 1];
[backgroundImageQueue insertObject:backgroundB.image atIndex:0];
[backgroundImageQueue removeLastObject];
}
动画的第一次迭代正常,但稍后只运行第二个动画。问题出在哪里?