Tengo el siguiente basado en bloques de animación:¿Cómo puedo reiniciar mi animación basada en bloques cuando la aplicación pasa a primer plano?
[UIView animateWithDuration:0.5f delay:0.0f
options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse|UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionCurveEaseInOut
animations:^{
[view.layer setTransform:CATransform3DMakeScale(1.3f, 1.3f, 1.0f)];
NSLog(@"animating");
}completion:^(BOOL finished){
NSLog(@"Completed");
}];
cuando la aplicación vuelve de estar en el fondo, el bloque de terminación se llama, y mis animaciones no reinicia. He intentado utilizar el siguiente método delegado para reiniciar las animaciones:
- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
*/
[[self viewController] animate];
......
}
pero esto no ha trabajado para restaurar las animaciones.
Del mismo modo, he probado los métodos establecidos en las respuestas a estas preguntas:
pero ninguna de las sugerencias se han trabajado para mi. ¿Hay alguna otra forma de reanudar animaciones UIView basadas en bloques cuando una aplicación ha regresado desde el fondo?
dónde demonios has encontrado '[enableAnimations UIView: SÍ]'? No veo ese método en ninguna parte :( – Nate
Un poco tarde, pero pruebe [UIView setAnimationsEnabled: YES]; –
Como puede ver que ya está en mi respuesta :) – CStreel