25

how to hide status bar .

in sdk 3.1 or lower version it is possible by adding this code in

- (void)applicationDidFinishLaunching:(UIApplication *)application{

[application statusBarHidden:TRUE];

}

but in 4.1 this method is not available in delegate class. i can see some site like this

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

it is also not working. any body know that how it will possible in iPhone sdk 4.1 ?

thanks and regards..

jaleel
  • 1,169
  • 8
  • 22
  • 46
  • @Zebs answer is the best for me and has the most votes, people should consider it instead of the accepted answer... – Adam Carter Jun 27 '12 at 15:34

5 Answers5

64

if you are doing it on the applicationDidFinishLaunching: there is an easier way of doing it:

The easiest way to hide the status bar (and this will work on any version) is to go into you Info.plist; right click to add a row and select Status Bar Initially hidden.

This will ensure every time you app launches the status bar will be hidden.

I can post scree shots if you need them, just let me know and hope this helps.

Zebs
  • 5,378
  • 2
  • 35
  • 49
22

Just put in delegate class.

        [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

It is working for me..I hope this will help you.

Umesh
  • 1,609
  • 1
  • 17
  • 28
20

Your method is now deprecated for iOS 5. You should use one of the following:

[[UIApplication sharedApplication] setStatusBarHidden:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
lohiaguitar91
  • 522
  • 5
  • 9
4

In iOS 7 , add the below two items another item to info.plist :

View controller-based status bar appearance = NO

Status bar is initially hidden = YES

Community
  • 1
  • 1
Abhishek Bedi
  • 5,205
  • 2
  • 36
  • 62
3

Please Add in Your AppDelegate Class

[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

(or)

Please Add In your Info.plist file add key View controller-based status bar appearance with value NO.and also add Status bar is initially hidden YES

It is really working for me

sathish
  • 1,180
  • 1
  • 9
  • 9