2

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

theDuncs
  • 4,649
  • 4
  • 39
  • 63
  • What does the `frame` property of your view return? – Chaitanya Gupta Aug 26 '11 at 19:17
  • I'm getting this: frame = (-170 170; 480 320) – theDuncs Aug 26 '11 at 19:31
  • Did you ever find a solution Duncan? i'm ripping my hair out on this one – Adam Waite Dec 07 '11 at 02:47
  • I didn't find a solution to this one Adam, but I did have a similar problem in a different project. The solution I went for was to simply extend the frame of the view so that it covered the missing pat (i.e. `[view setFrame:0,0,300,300]`) so that the frame now fills the area I want. Maybe try that? – theDuncs Dec 07 '11 at 12:16

1 Answers1

3

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]];
Cameron Spickert
  • 5,190
  • 1
  • 27
  • 34
  • Thanks Cameron. Just tried that. It didn't make any difference to the UI display. The frame of the navigation controller is set to this before and after the status bar is hidden: frame = (0 0; 320 480). Anything else you think I should check? I'll take a look through all the frame settings for the view hierarchy. – theDuncs Aug 26 '11 at 20:37