views:

3017

answers:

3

Just getting started with my first iPhone app. My app will be full screen, but I am having trouble finding the document that explains how to change the status bar properties. Anyone have any pointers?

+14  A: 

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO] should hide the status bar. Is that what you want?

edit: You could also add the following to Info.plist:

<key>UIStatusBarHidden</key>
<true />
dancavallaro
a couple comments: I seem to recall you can set these setting in Info.plist? Also, I am very new to Objective-C and the iPhone frameworks, so I am not sure where to put the line above, in applicationDidFinishLaunching?
Ryan
Not totally sure, but I imagine applicationDidFinishLaunching would be as good a place as any.
dancavallaro
In my case, using setStatusBarHidden in applicationDidFinishLaunching still allowed the status bar to show for a second or two during loading. Adding it to the plist file instead solved that and it does not show at all.
bmoeskau
Update: -setStatusBarHidden: animated: is deprecated now. You should drop the 'animated:' and just use[[UIApplication sharedApplication] setStatusBarHidden:YES]
MikeyWard
This method has been deprecated as of iOS4
Jon Limjap
+2  A: 

The status bar APIs are part of the UIApplication class. Start there.

August
A: 

Using Snow Leopard and the XCode 3.2, you simply edit the Apps Info.plist.

Add 2 rows:

Right click the open plist and add a row and select "Status bar is initially hidden" from the drop down list. Check the checkbox it provides in the column to the right.

Add another row and select "Status Bar Style" from the drop down list. In the column to the right type in UIStatusBarHidden

That works for me. I haven't experimented yet with changing the status bar view state at runtime though, say for example if the battery gets low.

And I'm not entirely sure that both values are needed if you add the second row's value.

// :)

Spanky