UINavigationBar shifted to the top covered by the status bar

一笑奈何 提交于 2019-12-10 22:37:00

问题


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];    
}

来源:https://stackoverflow.com/questions/6361354/uinavigationbar-shifted-to-the-top-covered-by-the-status-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!