Gap appears between navigation bar and view after rotating & tab switching
<p>My iphone application is showing strange behavior when rotating: a gap appears between the navigation title and content view inside a tab bar view (details on how to reproduce are below).   I've created a tiny test case that exhibits the same problem: a custom root UIViewController, which creates and displays a UITabBarController programmatically, which has two tabs: 1) plain UIViewController, and 2) UINavigationController created programmatically with a single plain UIViewController content view.</p>

<p>The complete code for the application is in the root controller's viewDidLoad (every "*VC" class is a totally vanilla UIViewController subclass with XIB for user interface from XCode, with only the view background color changed to clearly identify each view, nothing else).</p>

<p>Here's the viewDidLoad code, and the shouldAutorotateToInterfaceOrientation code, this code is the entire application basically:</p>

<pre><code>- (void)viewDidLoad {
    [super viewDidLoad];

    FirstVC *fvc = [[FirstVC alloc] initWithNibName:@"FirstVC" bundle:nil];
    NavContentsVC *ncvc = [[NavContentsVC alloc] initWithNibName:@"NavContentsVC" bundle:nil];
    UINavigationController *svc = [[UINavigationController alloc] initWithRootViewController:ncvc];

    NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:2];
    [localControllersArray addObject:fvc];
    [localControllersArray addObject:svc];

    fvc.title = @"FirstVC-Title";
    ncvc.title = @"NavContents-Title";

    UITabBarController *tbc = [[UITabBarController alloc] init];
    tbc.view.frame = CGRectMake(0, 0, 320, 460);
    [tbc setViewControllers:localControllersArray];
    [self.view addSubview:tbc.view];

    [localControllersArray release];
    [ncvc release];
    [svc release];
    [fvc release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return YES;
}
</code></pre>

<p>Here's how to reproduce the problem:</p>

<p>1) start application</p>

<p>2) rotate device (happens in simulator, too) to landscape (UITabBar properly rotates)</p>

<p>3) click on tab 2</p>

<p>4) rotate device to portrait -- notice gap of root view controller's background color of about 10 pixels high beneath the Navigation title bar and the Navigation content view.</p>

<p>5) click tab 1</p>

<p>6) click tab 2</p>

<p>And the gap is gone!    From my real application, I see that the gap remains during all VC push and pops while the NavigationController tab is active.   Switching away to a different tab and back to the Nav tab clears up the gap.</p>

<p>What am I doing wrong?   I'm running on SDK 3.1.3, this happens both on the simulator and on the device.   Except for this particular sequence, everything seems to work fine.  Help!</p>
