views:

35

answers:

2

I have set up a multiview application with two views. The views can be switched using a button in each view (there are two separate actions). I am using the animation UIViewAnimationTransitionFlipFromRight, and when I go from the first to the second view, the view I am going to appears behind the flipping animation. I would like it just to be white. Any help is appreciated.

alt text

This is the action switching the views:

    - (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];
}
A: 

You could try using addSubView which just adds it to the top of the stack.

willcodejavaforfood
As in [self.view addSubview: comming.view]; ?
MN
A: 

This kind of bug can be if comming.view is nil

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

Check, maybe your nib isn't loaded properly

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