我知道这个问题被问了很多,但我已经尝试了所有其他答案,但我无法弄清楚为什么动画停止选择器没有被调用。这是代码:
-(void) moveImage:(UIImageView *)image duration:(NSTimeInterval)duration curve:(int)curve x:(CGFloat)x y:(CGFloat)y annKey:(NSString *) annKey{
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:duration];
[UIView setAnimationCurve:curve];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);
image.transform = transform;
[UIView beginAnimations:annKey context:NULL];
[UIView commitAnimations];
}
这是发送所有正确参数的主要动画函数。
- (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context
{
if ([animationID isEqualToString:@"Burn"])
{
NSLog(@"Animation: %@ has finished.",animationID);
}
NSLog(@"This does not get called, why not?");
}
我的 NSLog 都没有显示文本。我究竟做错了什么?