UINavigationBar shifted to the top covered by the

2019-07-10 16:05发布

问题:

Has anyone ever encountered an issue where a navigation bar with custom background is shifted to the top when the screen is transitioning between a hidden status bar and a shown status bar?

The problem is this issue doesn't happen with a debug build, but it does happen with a release build. I'm really confused because I'm not using any conditionals for UI behaviors.

Additionally, this will only happen if the app is entering a foreground mode in a "fullscreen" state. Then I switched from a fullscreen state to a non-fullscreen state, the problem occurs.

Update: this issue occurs regardless of whether I'm using a custom background or not.

I'm using iOS 4.3 SDK running on iOS 4.3.3.

I do this transition like this:

UIWindow *window = [[UIApplication sharedApplication] firstWindow];
[window addMoveInTransitionWithDuration:0.5 subtype:kCATransitionFromBottom];
[self.fullScreenViewController.view removeFromSuperview];

[self presentNonFullScreenViewAnimated:NO];

This is the firstWindow method:

- (UIWindow *)firstWindow
{
  if ([self.windows count] > 0)
    return [[self windows] objectAtIndex:0];

  return [self keyWindow];
}

This is the presentNonFullScreenViewAnimated: method

- (void)presentNonFullScreenViewAnimated:(BOOL)animated
{   
  [[UIApplication sharedApplication] setStatusBarHidden:NO];
  [self.navigationController setNavigationBarHidden:NO animated:NO];

  NonFullScreenViewController *viewController = [[NonFullScreenViewController alloc] init];
  [self.navigationController pushViewController:viewController animated:animated];
  [viewController release];    
}