Hiding UIStatusBar leaves empty blue bar across screen

I have a portrait iPhone app, which a hidden navigation bar controlling the flow between views. In one view, I need to rotate the view 90 degrees to landscape, and I want to hide the status bar.

The problem is that whilst the status bar is correctly hidden, it leaves an empty light-blue bar across the top of the screen where the status bar was. My view actually sits under this bar, filling the screen.

I've tried playing with the size of the view, but its already set to the full size of the screen. It seems this blue bar is ABOVE my view.

Could it be because I have hidden both the navigation bar and the status bar?

Any help, much appreciated.

Dunc


If you're using a UINavigationController with its navigation bar hidden (a UINavigationBar does nothing on its own), then you need to adjust the navigation controller 's frame in the window, not the frame of your view controller's view in the navigation controller. Here's your view hierarchy:

window (root view)
  - statusBar
  - navigation controller's view
    - view controller's view

Try this in your view controller when you hide the status bar:

[[[self navigationController] view] setFrame:[[UIScreen mainScreen] bounds]];

Or, if you want to use the window's frame:

[[[self navigationController] view] setFrame:[[[UIApplication sharedApplication] keyWindow] bounds]];
链接地址: http://www.djcxy.com/p/42688.html

上一篇: 在单一视图上隐藏iPhone上的状态栏?

下一篇: 隐藏UIStatusBar在屏幕上留下空的蓝条