UIView transitionWithView no funciona
Aquí está viewDidLoad desde el controlador de vista principal en el proyecto de prueba:
- (void)viewDidLoad
{[super viewDidLoad];
UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 300, 300)];
[self.view addSubview:containerView];
UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
[redView setBackgroundColor:[UIColor redColor]];
[containerView addSubview:redView];
UIView *yellowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
[yellowView setBackgroundColor:[UIColor yellowColor]];
[UIView transitionWithView:containerView duration:3
options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
[redView removeFromSuperview];
[containerView addSubview:yellowView];
}
completion:NULL];
}
El cuadro amarillo simplemente aparece. No hay animación, no importa qué UIViewAnimationOption intente. ¿¿¿Por qué??
EDIT: también he intentado usar performSelector withDelay para mover la animación fuera de viewDidLoad y a otro método. Mismo resultado: sin animación.
También intentó esto: [UIView transitionFromView: redView toView: yellowView duración: 3 opciones: UIViewAnimationOptionTransitionFlipFromLeft finalización: NULL];
Todavía, la vista amarilla simplemente aparece. Sin animación