Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

I'm a Mac

macrumors 6502
Original poster
Nov 5, 2007
436
0
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?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Use the

Code:
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated

method of UIApplication.
 

I'm a Mac

macrumors 6502
Original poster
Nov 5, 2007
436
0
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;;'
 

allbrokeup

macrumors regular
Mar 6, 2008
249
0
Melbourne, Australia
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
 

gruddlebug

macrumors newbie
Sep 13, 2008
7
0
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
 

I'm a Mac

macrumors 6502
Original poster
Nov 5, 2007
436
0
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.
 

gruddlebug

macrumors newbie
Sep 13, 2008
7
0
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.