Friday, June 27, 2008

Hide Status Bar

This is how to hide the status bar in iPhone. For the Open toolchain api is available. However, for Official SDK API, edit the Info.plist is necessary.


Official iPhone OS 2.0 SDK headers version


Info.plist : Select all

<key>UIStatusBarHidden</key>
<true />

or. programmatically,

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];


Open Tool Chain headers version


Hello.app : Select all


[UIHardware _setStatusBarHeight:0.0f];
[self setStatusBarMode:2 duration:0.0f];
[self setStatusBarHidden:YES animated:NO]; // hide status bar

12 comments:

  1. Thanks! that post rocked my morning. It's the little perks...

    ReplyDelete
  2. Great! The info.plist method didn't do anything for me, but putting the setStatusBarHidden:YES line into applicationDidFinishLaunching did the trick for me. (iPhone OS 2.2.1)

    ReplyDelete
  3. it seems this method can't be run in os 3.0 beta4......

    ReplyDelete
  4. Thank you anonymous for mentioning where that the line went into applicationDidFinishLaunching

    It did nothing until I put it in the right place. :)

    ReplyDelete
  5. info.plist approach works also -- when editing in XCode enter value of 1 for UIStatusBarHidden key rather than true.

    ReplyDelete
  6. Thanks for the tip. For me it worked better modifying the info.plist file, than adding the line to applicationDidFinishLaunching. The latter would show it first and then hide it.

    ReplyDelete
  7. if you do UIStatusBarHidden, make sure to control click the value column and change the type to boolean. Then make sure the value is checked (=true)

    ReplyDelete
  8. FWIW, setting it with the code left the status bar showing during the thumbnail zoom (at least in my simulator) using the info.plist entry it doesnt appear in the thumb zoom either. (sorry, i dont know what that thing should be called... the app start animation)

    OS 3.1.3

    ReplyDelete
  9. whew, finally know how to get that anyoning status bar out of the way!

    ReplyDelete
  10. Thanks! I was trying to figure out how to do this.

    Note: setStatusBarHidden animated has been deprecated. Use this instead:

    [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

    ReplyDelete
  11. Thanks! Forgot how to do this and Google Search brought me to your blog. :)

    ReplyDelete
  12. thank you thank you and thannnnnk you :)

    ReplyDelete