En utilisant bloc achèvement Handler dans iOS 4 pour l'animation
-
28-09-2019 - |
Question
je voudrais animer mon mouvement de sous-vues lors de la rotation du dispositif, le changement de alpha à 0, déplacer le point de vue de la nouvelle position et réinitialiser l'alpha à 1.
En utilisant ce code dans didRotateFromInterfaceOrientation
provoque la vue de flash et fondu très rapidement puis réapparaître. Je voudrais éviter ce problème.
[UIView animateWithDuration:kAnimationDuration animations:^{
anObject.alpha = 0.0;
CGRect newFrame = anObject.frame;
newFrame.origin.x = newX;
newFrame.origin.y = newY;
newFrame.size.width = newWidth;
newFrame.size.height = newHeight;
anObject.frame = newFrame;
} completion:^ (BOOL finished){
if (finished) {
anObject.alpha = 1.0;
}
}];
Y at-il un moyen de contourner ce clignotement?
Merci
La solution
Peut-être effectivement Animer alpha à la fin? plutôt que de flasher? :)
[UIView animateWithDuration:kAnimationDuration animations:^{
anObject.alpha = 0.0;
CGRect newFrame = anObject.frame;
newFrame.origin.x = newX;
newFrame.origin.y = newY;
newFrame.size.width = newWidth;
newFrame.size.height = newHeight;
anObject.frame = newFrame;
} completion:^ (BOOL finished){
if (finished) {
[UIView animateWithDuration:kAnimationDuration
animations:^{
anObject.alpha = 1;}
}
}];
Cordialement, Krzysztof Zabłocki
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow