0
,我为动画创建以下方法:的iOS 6.1的动画不能正常工作
-(void)shakingAnimationForGate:(UIImageView *)image leftShaking:(CGAffineTransform)leftTransform rightShaking:(CGAffineTransform)rightTransform animationName:(NSString *)string{
[UIView animateWithDuration:5.0
delay:0.5
options: UIViewAnimationOptionCurveEaseOut
animations:^{
image.transform = leftTransform; // starting point
[UIView beginAnimations:string context:(__bridge void *)(image)];
[UIView setAnimationRepeatAutoreverses:YES]; // important
[UIView setAnimationRepeatCount:20];
[UIView setAnimationDelay:0.1];
[UIView setAnimationDuration:0.06];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(shakeEnded:finished:context:)];
image.transform = rightTransform; // end here & auto-reverse
[UIView commitAnimations];
}
completion:^(BOOL finished){
NSLog(@"end of shaking");
}];
}
这使得UIView的做了“摇晃”。
那么我使用这种方法:
CGAffineTransform leftShake = CGAffineTransformMakeTranslation(-2, 6);
CGAffineTransform rightShake = CGAffineTransformMakeTranslation(0, 3);
[self shakingAnimationForGate:imageLeft leftShaking:leftShake rightShaking:rightShake animationName:@"left view shake"];
其中imageLeft是的UIImageView。
所以我的问题是,这种方法不会在iOS 6.1上做抖动动画。但它在iOS 7上运行良好。任何想法是什么问题?
只是做[UIView动画]? –
你的意思是commitAnimations?它已经在我创建的方法 – ignotusverum
我假设你正在尝试做一个动画发生20次?哪个开始点A,动画到B点,然后从点A开始全部? –