2011-10-04 7 views
1

J'utilise le code suivant dans Xcode à l'horizontale bascule entre 2 vues dans une application iPhoneModal View Controller

-(IBAction)switchView:(id)sender{ 
    Algorithm2ViewController *Algorithm2ViewControllergo = [[Algorithm2ViewController alloc] 
                  initWithNibName:@"Algorithm2ViewController"             bundle:nil]; 

    [UIView beginAnimations:@"flipview" context:nil]; 
    [UIView setAnimationDuration:1]; 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft 
          forView:self.view cache:NO]; 
    [self.view addSubview:Algorithm2ViewControllergo.view]; 

    [UIView commitAnimations]; 
} 

après la première bascule je reçois une image de la vue à venir en arrière-plan avant la fin de le flip comment puis-je m'en débarrasser?

Répondre

0

J'ai compris cela dans la deuxième vue ajouter le code suivant

-(IBAction)switchView2:(id)sender{ 

    SecondViewController *SecondViewControllergo = [[SecondViewController alloc] 
                initWithNibName:@"SecondView" 
                bundle:nil]; 

    [UIView beginAnimations:@"flipview" context:nil]; 
    [UIView setAnimationDuration:2]; 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft 
          forView:self.view.superview cache:NO]; 
    [self.view addSubview:SecondViewControllergo.view]; 
    [self.view removeFromSuperview]; 
    [UIView commitAnimations]; 
    [SecondViewControllergo release]; 


} 

Le supprimer de la ligne superview supprimera l'image d'arrière-plan