Ad

Our DNA is written in Swift
Jump

NavigationController from NIB produces sticky gray empty status bar on rotation

I’ve decided that I’ll share my bug reports on my blog from now on as well. Usually you’ll have to make a small demo project to demonstrate the bug to Apple’s engineers and then they are the only ones to see my work. What a waste.

I still believe that Apple’s Bug Reporting system should be open for everybody, but since Apple is still run like a small startup they feel that it helps them conserve more resources to have it closed. That’s why there is Open Radar which somebody put on Google App Engine.

So, here’s my full bug report plus the demo project and screen shot. See if you can reproduce it and find a workaround.


NavigationController from NIB produces sticky gray empty status bar on rotation

16-Aug-2010 06:40 PM Oliver Drobnik KG:
Summary:

If you load a navigation controller from MainWindow.xib, but add the first view controller in appDidFinishLaunching, then there is a problem on rotation. A gray empty status bar appears underneath the regular status bar which cannot be eliminated.

Steps to Reproduce:

  • Create a Navigation based project.
  • Set status bar to be initially hidden.
  • Set navigation controller to want full screen and have nav bar hidden
  • Implement a tap method in the view controller to hide and show the status bar
  • Move the view controller outside of the navigation controller in the IB
  • Add a line to app delegate to push the now separate view controller onto the navigation controller.
  • Start the app, rotate once sideways with shown status bar
  • tap to hide the status bar

Expected Results:

No extra gray status bar.

Actual Results:

A sticky gray status bar appears underneath the disappearing regular status bar.

I’m attaching a project to demonstrate the behavior. Plus a screenshot.

The behavior is inconsistent with creating a navigation controller in code. There no extra status bar appears.


Discussion

I filed this bug report on Open Radar as well. Here’s the Project file I’m referencing: StatusBarBug.zip

To see the bug for yourself launch the demo project in iPad Simulator. Tap the screen to show the black status bar. Then rotate the simulator once. Tap the screen again to hide the status bar. Behind it this gray bar appears.

This is how the screen looks like with the extraneous status bar showing.

Iif you set the navigation controller’s root view controller already in the NIB (as it’s usually the case) then this behavior does not occur. So for this demo I moved the view controller outside of the navigation controller.

If you don’t instantiate the navigation controller via a NIB file, but instead put the following code into the applicationDidFinishLaunching, then you will not see this extra bar.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	// could also initWithRootViewController, same effect
 
 	navController = [[UINavigationController alloc] init];
	navController.wantsFullScreenLayout = YES;
	navController.navigationBar.hidden = YES;
 
	[navController pushViewController:viewController animated:NO];
 
	[window addSubview:navController.view];
	[window makeKeyAndVisible];
 
	return YES;
}

This leads me to the conclusion that something funny is happening when getting your navigation controller from a xib (without root view controller set) versus instantiating it in code. Which prompted me to file this bug. If you find that it is actually something that I am doing wrong here, please let me know.


Categories: Bug Reports

Leave a Comment