tenga en cuenta el siguiente código y dígame qué estoy haciendo mal.Flip View Iphone
Quiero pasar de una a otra UIViews.
De alguna manera, cuando me alejo de la vista inicial, acabo de obtener la vista volteada, sin animación. Cuando vuelvo, la animación se muestra bien.
Los saltos se activan desde los botones de las vistas.
- (IBAction)showMoreInfo:(id)sender
{
UIView *moreInfo = self.flipView;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationBeginsFromCurrentState:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
UIView *parent = self.view.superview;
[self.view removeFromSuperview];
[parent addSubview:moreInfo];
[UIView commitAnimations];
}
- (IBAction)showLessInfo:(id)sender
{
UIView *lessInfo = self.view;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationBeginsFromCurrentState:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.flipView cache:YES];
UIView *parent = self.flipView.superview;
[self.flipView removeFromSuperview];
[parent addSubview:lessInfo];
[UIView commitAnimations];
}
Querido Jason, cuando hago la auto.view.superview, se ve bien en showMoreInfo :, pero volviendo atrás (usando showLessInfo :) ahora se comporta mal: simplemente muestra la vista inicial sin animación. Poner self.view.superview en este método no ayuda. Estoy seguro de que soy muy estúpido, pero solo dame una línea más de código, y estaría muy agradecido. –
Lo siento por ser estúpido. Puse self.flipView.superview y todo está bien ahora! –