2010-10-09 4 views
0

Je le code d'animation de base suivante dans mon application:iPhone Core Animation ne fonctionne pas en douceur?

-(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; 

Et puis quand les finitions d'animation:

-(void)animationFinished : (NSString *)theAnimation finished : (BOOL)flag context : (void *)context { 


((UIView *)context).alpha = 1.0; 
((UIView *)context).transform = CGAffineTransformIdentity; 

[self startCoreAnimation]; 

} 

Le problème est que, après l'animation terminé l'icône « sauts » revenir à sa L'état alpha de 1. On dirait que l'icône s'estompe, ne se déforme pas puis passe à alpha 0 et revient ensuite à alpha 1. Entre les deux dernières étapes (alpha 0 à alpha1) il y a un petit espace qui cause le bégaiement. Quelqu'un peut-il aider?

Merci,

Martin

Répondre

0

Si vous voulez juste pour boucler l'animation, vous pouvez également utiliser

[UIView setAnimationRepeatCount:1e100f];

Selon le documentation:

Réglage de la repeatCount à 1e100f sera provoque la répétition de l'animation jusqu'à ce que soit supprimé du calque.

Questions connexes