2010-02-12 6 views
1

J'ai configuré une application multiview avec deux vues. Les vues peuvent être changées en utilisant un bouton dans chaque vue (il y a deux actions séparées). J'utilise l'animation UIViewAnimationTransitionFlipFromRight, et quand je passe de la première à la deuxième vue, la vue que je vais voir apparaît derrière l'animation retournée. Je voudrais juste être blanc. Toute aide est appréciée.L'affichage de l'iPhone apparaît derrière l'animation

alt text http://img35.imageshack.us/img35/9982/picture11wu.png

Ceci est l'action de commutation de la vue:

- (IBAction)switchViewsOne:(id)sender 
{ 

if (self.uLViewController == nil) 

{ 

ULViewController *uLController = 

[[ULViewController alloc] 

initWithNibName:@"ULView" 

bundle:nil]; 

self.uLViewController = uLController; 

[uLController release]; 

} 

    [UIView beginAnimations:@"View Flip" context:nil]; 
    [UIView setAnimationDuration:1.25]; 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 

    UIViewController *comming = nil; 
    UIViewController *going = nil; 
    UIViewAnimationTransition transition; 

    if (uLViewController.view.superview == nil) 
    { 
     comming = uLViewController; 
     going = mainViewController; 
     transition = UIViewAnimationTransitionFlipFromLeft; 
    } 

    [UIView setAnimationTransition: transition forView:self.view 
          cache:YES]; 
    [comming viewWillAppear:YES]; 
    [going viewWillDisappear:YES]; 
    [going.view removeFromSuperview]; 
    [self.view insertSubview: comming.view atIndex:10]; 
    [going viewDidDisappear:YES]; 
    [comming viewDidAppear:YES]; 


    [UIView commitAnimations]; 
} 

Répondre

0

Vous pouvez essayer d'utiliser addSubview ce qui ajoute au sommet de la pile.

+0

Comme dans [self.view addSubview: comming.view ] ? – potato

0

Ce genre de bug peut être si comming.view est nul

[self.view insertSubview: comming.view atIndex:10]; 

Vérifiez, peut-être votre plume est pas correctement chargé

ULViewController *uLController = [[ULViewController alloc] initWithNibName:@"ULView" bundle:nil]; 
NSLog(@"Loaded controller %@:", uLController);