Question

I have set a UITabBarController as the root view controller in the AppDelegate.

I have added a loading view upon the window, while the app downloads some data. I have hidden the status bar while the loading screen is visible. As soon as the loading is done, I fade the loading view and shows the status bar again.

My problem is that when I show the status bar the navigation bar was not drawn to have the right height, because the status bar was hidden when it was drawn. If I change to another tab it gets the right height.

I have tried with [navigationController.view setNeedsLayout], but that seems to get the position of the view of the ViewController right, but the content of the navigation bar does not resize. I have also tried with [navigationController.navigationBar setNeedsLayout], but that does help at all.

So I basically want to get the navigation drawer get the right height for the status bar and content when the loading view fades. How can I do this?

Was it helpful?

Solution

Have you try to reset the navigation and status bar as like below?

-(void)resetNavigationBar
{
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

    [self.navigationController setNavigationBarHidden:YES];

    [self.navigationController setNavigationBarHidden:NO];
}

OTHER TIPS

I would unhide the status bar in the viewWillDisappear: method on the loading view.

- (void)viewWillDisappear:(BOOL)animated
{
     [super viewWillDisappear:animated];
     [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top