views:

138

answers:

1

I have an tabbar-application with four tabs. Every tab loades an nib with its viewcontroller. In my first nib i have two views. In the first view (placeholder) is a button to switch to the second view (view1) and reverse (With an Boolean to see if the second view is on top or not).

-(IBAction)transitionFlip {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.5];  
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
    if (view1OnTop) {
        [view1 removeFromSuperview];
        view1OnTop = NO;
    }
    else {
        [placeholder addSubview:view1];
        view1OnTop = YES;
    }
    [UIView commitAnimations];
}

The Problem: When i click on the button it works fine. But the Second-Tabbar Nib is on the animation-background? When i click on the Second-Tabbar and go back to the first, then the animation-background is white (as it should).

In the Main Appdelegate i have only added two Controllers:

[window addSubview:navigationController.view];
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];

Any ideas?

+1  A: 

The problem is likely caused by adding both navigationController.view and tabBarController.view as subviews of UIWindow. Instead of this view hierarchy:

UIWindow -> [UITabBarController -> [view, view, ...], UINavigationController -> view]

try adding only tabBarController's view to the window, and letting it manage separate UINavigationControllers for each tab:

UIWindow -> UITabBarController -> [UINavigationController -> view, UINavigationController -> view, ...]

dbarker
Thanks! That was the reason.
x2on