Come è possibile eseguire un CABasicAnimation dopo che l'altro è terminato? In altre parole sequenzialmente. Ho aggiunto il tempo della seconda animazione iniziare, tuttavia sembra che la seconda animazione non viene eseguito:in esecuzione CABasicAnimation in sequenza
CABasicAnimation * appearance =[CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
appearance.duration = 0.5;
appearance.fromValue = [NSNumber numberWithFloat:0];
appearance.toValue = [NSNumber numberWithFloat:340];
appearance.repeatCount = 1;
appearance.fillMode = kCAFillModeForwards;
appearance.removedOnCompletion = NO;
[notif.layer addAnimation:appearance forKey:@"transform.translation.y"];
CABasicAnimation * theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
theAnimation.duration = 0.5;
theAnimation.fromValue = [NSNumber numberWithFloat:0];
theAnimation.toValue = [NSNumber numberWithFloat:10];
theAnimation.repeatCount = 3;
theAnimation.autoreverses = YES;
theAnimation.fillMode = kCAFillModeForwards;
theAnimation.removedOnCompletion = NO;
theAnimation.beginTime = appearance.beginTime + appearance.duration;
[notif.layer addAnimation:theAnimation forKey:@"transform.translation.y"];
Qualsiasi idea del perché?
questo non ha funzionato ..the animationDidStop è stato chiamato infinitamente – adit
hai copiato entrambi i pezzi di codice? Non sono la stessa cosa. –
Se hai un ciclo, sei sicuro di non aver impostato il delegato della seconda animazione in modo che anche la seconda animazione stia chiamando animationDidStop? – isaac