user346443
user346443

Reputation: 4852

IOS 4.3 hide status bar permanently

I'm trying to hide the status bar in iOS 4.3 now that setStatusBarHidden:animated: is deprecated:

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

The only option that exists in the plist file is: Status bar is initially hidden. Which only hides the status bar at the start of the app.

Cheers

Upvotes: 34

Views: 48788

Answers (5)

sobstel
sobstel

Reputation: 1462

seStatusBarHidden seems to be deprecated and not working anymore.

Use prefersStatusBarHidden on your view controller instead

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

Upvotes: 0

Ashar
Ashar

Reputation: 217

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

Upvotes: 0

crimi
crimi

Reputation: 875

Try this:

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

From Apple Class Reference:

setStatusBarHidden:withAnimation:

Hides or shows the status bar, optionally animating the transition. - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation Parameters

hidden YES to hide the status bar, NO to show the status bar.

animation A constant that indicates whether there should be an animation and, if one is requested, whether it should fade the status bar in or out or whether it should slide the status bar in or out.

Upvotes: 74

NWCoder
NWCoder

Reputation: 5266

The new method is:

- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation

Works the same except the animation type is an enum now to support various animation types.

Upvotes: 4

Till
Till

Reputation: 27597

But how about [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

See the UIApplication reference.

Upvotes: 8

Related Questions