10

At the start of my app, the status bar is hidden, due to the Info.plist setting called Status bar is initially hidden. Later on, I want to show the status bar using:

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

but I get a warning saying that the function is deprecated. Does anybody know what the new function is?

HopelessN00b
  • 452
  • 2
  • 8
  • 22
David Skrundz
  • 13,067
  • 6
  • 42
  • 66
  • possible duplicate of [About setStatusBarHidden](http://stackoverflow.com/questions/3028255/about-setstatusbarhidden) – Georg Fritzsche Jul 17 '10 at 22:33
  • 1
    The documentation clearly says which method to use: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIApplication_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/instm/UIApplication/setStatusBarHidden:animated: – Felix Kling Jul 17 '10 at 22:44

3 Answers3

16

setStatusBarHidden:withAnimation: is the new method, which takes a UIStatusBarAnimation instead of a BOOL, so you can choose what animation is used to hide the status bar.

Douwe Maan
  • 6,888
  • 2
  • 34
  • 35
3

It is:

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

See the UIApplication class reference for more info.

If you are trying to write code for both iOS 3.x and iOS 4.x, you are going to run into a further issue that the new method is not available in the old iOS. See this question for further info.

Community
  • 1
  • 1
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
1

Add this to your AppDelegate.m

    [UIApplication sharedApplication].statusBarHidden = YES;
Bernd
  • 11,133
  • 11
  • 65
  • 98