views:

293

answers:

0

I am upgrading my iPhone application to run "natively" on iPad and am coming into a difficulty when hiding the navigation bar in landscape and showing it again in portrait.

In my BaseViewController:

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

    [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];

    // HIDE NAVIGATION BAR
    [[self navigationController] setNavigationBarHidden:UIDeviceOrientationIsLandscape(toInterfaceOrientation) animated:YES];

    // HIDE TAB BAR
    if ([self tabBarController]) {
        [(RotatingTabBarController*)[self tabBarController] hideTabBar:UIDeviceOrientationIsLandscape(toInterfaceOrientation) animated:YES];
    }

    // HIDE STATUS BAR
    [[UIApplication sharedApplication] setStatusBarHidden:UIDeviceOrientationIsLandscape(toInterfaceOrientation) withAnimation:YES];

}

On the iPhone this works fine, however on the iPad although hidden in Landscape; when returning to Portrait the navigation bar has been cut short at just over 50% of the width.

Furthermore although I expect unrelated, I am using a custom UINavigationBar category with an overridden drawRect: method.

Any ideas?

Thanks!