【发布时间】:2010-10-09 20:15:03
【问题描述】:
我的应用中有以下核心动画代码:
-(void)startCoreAnimation
[UIView beginAnimations:@"IconFade" context:Icon];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:1];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
icon.alpha=0.0;
[UIView commitAnimations];
break;
然后当动画结束时:
-(void)animationFinished : (NSString *)theAnimation finished : (BOOL)flag context : (void *)context {
((UIView *)context).alpha = 1.0;
((UIView *)context).transform = CGAffineTransformIdentity;
[self startCoreAnimation];
}
问题在于,动画完成后,图标“跳”回到它的 alpha 状态 1。看起来图标淡出,淡出然后转到 alpha 0,然后又回到 alpha 1。在最后两个步骤之间( alpha 0 到 alpha1) 有一个小间隙导致口吃。有人可以帮忙吗?
谢谢,
马丁
【问题讨论】:
标签: iphone objective-c uikit core-animation