Black status bar (as seen in home screen) possible?

Discussion in 'iPhone/iPad Programming' started by I'm a Mac, Sep 26, 2008.

  1. macrumors 6502

    Joined:
    Nov 5, 2007
    #1
    I know how to hide the menu bar, but when the menu bar isn't hidden, it's usually a conspicuous gray. How do you make the menu bar black, like it is while viewing the home screen, or blend in to another image, as it does when viewing photos in the Photo application?
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Use the

    Code:
    - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated
    method of UIApplication.
     
  3. thread starter macrumors 6502

    Joined:
    Nov 5, 2007
    #3
    I added this method to the
    Code:
    applicationDidFinishLaunching [[UIApplication sharedApplication] setStatusBarStyle:(UIStatusBarStyle) animated:YES]];
    
    and I get an error message that "animated is undeclared and a warning that UI application might not respond to '-setStatusBarStyle;;'
     
  4. macrumors 6502

    Joined:
    Mar 6, 2008
    Location:
    Melbourne, Australia
    #4
    Both of those code-tidbits will show up the original window with the Gray status bar, then it will flicker to Black.

    The only way (and the best way) is to modify the Info.plist in Xcode of your App.

    Key:
    UIStatusBarStyle
    String:
    UIStatusBarStyleOpaqueBlack or UIStatusBarStyleBlackOpaque or UIStatusBarStyleBlackTransparent

    Then when you launch the app, it has the Black bar from start to finish. No flicker. :D
     
  5. macrumors newbie

    Joined:
    Sep 13, 2008
    #5
    Hello,

    In the Info.plist file set the status bar to hidden

    In app Set the style to black with:

    [application setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];

    Now show the status bar animate to the style to avoid flicker:

    [application setStatusBarHidden:NO animated:YES];

    Hope that helps (and works;))

    evs
     
  6. thread starter macrumors 6502

    Joined:
    Nov 5, 2007
    #6
    I don't quite know the correct way to edit the info.plist file. Mine doesn't contain code, it just is a table that says Key and Value. It has information like the bundle identifier.
     
  7. macrumors newbie

    Joined:
    Sep 13, 2008
    #7
    Hello,

    open Info.plist in TextEdit and add the two lines below and save again (or <false/> if that's what you want in an app)

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


    OR in Xcode / Property List Editor editor

    ctrl click (or right click) a row, select Add Row from pop up menu, name it UIStatusBarHidden.
    Then ctrl (right) click on the row, select Value Type - boolean. Then check or uncheck it as required.

    evs
     

Share This Page