Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-setStatusBarHidden:animated: is deprecated

Tags:

iphone

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?

like image 942
David Skrundz Avatar asked Jul 17 '10 22:07

David Skrundz


3 Answers

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.

like image 54
Douwe Maan Avatar answered Oct 10 '22 07:10

Douwe Maan


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.

like image 32
William Jockusch Avatar answered Oct 10 '22 08:10

William Jockusch


Add this to your AppDelegate.m

    [UIApplication sharedApplication].statusBarHidden = YES;
like image 44
Bernd Avatar answered Oct 10 '22 07:10

Bernd