J'ai une animation qui déplace certaines vues. Lorsque cette animation est terminée, je veux que la fenêtre recalcule la boucle keyview. Mon code est simmilar au suivi du code maquette:Comment déclencher un rappel lorsqu'un NSAnimationContext se termine?
[NSAnimationContext beginGrouping];
[newView setAlpha: 0.0]; //hide newView
[self addSubView:newView];
//position the views
[[oldView animator] setFrame: newFrame1];
[[newView animator] setFrame: newFrame2];
[[newView animator] setAlpha: 1.0]; //fade-in newView
[NSAnimationContext endGrouping];
[[self window] recalculateKeyViewLoop];
Le problème avec ce code est que recalculateKeyViewLoop
est appelé avant que les vues sont dans leurs nouvelles positions qui signifie que le keyviewloop est erroné.
Comment résoudre ce problème?
Mon premier cependant est d'appeler recalculateKeyViewLoop
dans un rappel de quand l'animation se termine mais je n'arrive pas à comprendre comment faire ceci.