Change iPhone App Status Bar Properties

My app will be full screen, but I am having trouble finding the document that explains how to change the status bar properties.

How can I change the status bar properties?

Answers


[[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 />

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


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.

// :)


Since the old way has been deprecated:

// Old, Deprecated
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];

The iOS 3.2+ way is

[[UIApplication sharedApplication] setStatusBarHidden:YES
                                        withAnimation:UIStatusBarAnimationFade];

The animation options are:

UIStatusBarAnimationNone  // No animation is applied
UIStatusBarAnimationFade  // The status bar fades in and out
UIStatusBarAnimationSlide // The status bar slides in or out

And you can still do it the iOS 2.0+ way, with no animation:

[[UIApplication sharedApplication] setStatusBarHidden:YES];

Need Your Help

CoreData error: +entityForName: could not locate an NSManagedObjectModel for entity name

objective-c xcode core-data

I've been struggling with CoreData for a few days, but I keep getting this error:

Gradle build null console object

gradle android-gradle build.gradle

I'm trying to get my gradle builds to prompt at the console for a password using examples from stack overflow