我有一个要淡入然后淡出的标签。这是我的代码:
-(void) fadein
{
scoreLabel.alpha = 0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:2];
scoreLabel.alpha = 1;
[UIView commitAnimations];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
}
-(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
scoreLabel.alpha = 0;
[UIView commitAnimations];
}
从这段代码中我得到了这种情况:我的标签淡入,然后我看不到淡出动画。我该如何解决?