Pregunta

Me gustaría animar mi movimiento subvistas cuando se gira el dispositivo, el cambio de la alfa a 0, mueva el fin de la nueva posición y restablecer el alfa a 1.

El uso de este código en didRotateFromInterfaceOrientation hace que el objeto de flash y se desvanece muy rápidamente y luego vuelven a aparecer. Me gustaría evitar este comportamiento.

[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;
    }
}];

¿Hay una manera de evitar este parpadeo?

Gracias

¿Fue útil?

Solución

Tal vez en realidad animado alfa en la terminación? en lugar de Flash It? :)

[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;} 
} 
}];

Cheers, Krzysztof Zablocki

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top