85

Is there a way to hide the status bar when showing splash screen in iPhone and then show again in application?

Rex Nihilo
  • 604
  • 2
  • 7
  • 16
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256

10 Answers10

191

I'm pretty sure that if your Info.plist file has the Status bar is initially hidden value set to YES, then it won't show while your application is loading. Once your application has loaded, you can re-show the status bar using UIApplication's setStatusBarHidden:animated: method.

KlimczakM
  • 12,576
  • 11
  • 64
  • 83
Dave DeLong
  • 242,470
  • 58
  • 448
  • 498
  • 1
    there is no such option in info.plist.is there a way to add it manually – Rahul Vyas Jul 20 '09 at 07:10
  • 3
    @Rahul select the last line in thefileand then click the plus button over on the right end of the line. Then type it in yourself. – Dave DeLong Jul 20 '09 at 12:45
  • 2
    The method re-show the status bar is now, setStatusBarHidden:withAnimation: – SargeATM Sep 16 '10 at 19:31
  • 2
    Should you want to add it manually, you can edit the plist in a text editor like BBEdit and add the lines: UIStatusBarHidden just above the line. Or in Xcode right click on the plist and choose Open As...Source Code and edit it as text. – JScarry Jan 07 '13 at 17:09
  • 9
    "Once your application has loaded, you can re-show the status bar" Just to clarify if anyone is confused, it's safe to set `[[UIApplication sharedApplication] setStatusBarHidden:NO];` on - application:didFinishLaunchingWithOptions: – Ryan Romanchuk Jan 23 '13 at 08:14
  • 1
    like @RyanRomanchuk said, in iOS 9 and Swift, set status bar hidden to false like this: ```UIApplication.sharedApplication().statusBarHidden = false``` in ```application:DidFinishLaunchingWithOptions``` – kishorer747 Jul 13 '16 at 07:52
  • In my case just add key View controller-based status bar appearance: YES, in Plist and delete the app and re-run app. It works!! – Ravi Jun 07 '18 at 13:16
48

The correct key in .plist is "UIStatusBarHidden" and make checked right side.It'l become "Status bar is initially hidden" then automatically. In my practice, you can control the StatusBar's show/hide anywhere by when hide:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[UIApplication sharedApplication].keyWindow.frame=CGRectMake(0, 0, 320, 480); //full screen.

when show:

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
[UIApplication sharedApplication].keyWindow.frame=CGRectMake(0, 20, 320, 460); //move down 20px.

hope this was helpful to you.

Luke
  • 11,426
  • 43
  • 60
  • 69
Max
  • 547
  • 4
  • 9
  • To dynamically setting the size of the CGRectMake to any type of iPhone: `[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];` `float width = ((UIScreen *)[UIScreen mainScreen]).bounds.size.width;` `float height = (((UIScreen *)[UIScreen mainScreen]).bounds.size.height - 20);` `[UIApplication sharedApplication].keyWindow.frame = CGRectMake(0, 20, width, height);` – reinaldoluckman Sep 17 '13 at 19:50
  • UIApplication's `setStatusBarHidden:withAnimation` is expecting a NSInteger typedef `UIStatusBarAnimation` for the second argument, not a BOOL. Instead of `NO`, use `UIStatusBarAnimationNone` – user Mar 19 '14 at 22:42
23

View -> Property List Type -> iPhone Info.plist. Now, make a new item with "Status bar is initially hidden" checked.

Jonathan Sterling
  • 18,320
  • 12
  • 67
  • 79
6

For Xcode 5 and above you can just set:

View controller-based status bar appearance to NO

In your info.plist, or in the info tab on your main project.

Example of Info settings in xcode

Ian Jamieson
  • 4,376
  • 2
  • 35
  • 55
6

Following up Dave's answer the key "Status bar is initially hidden" didn't work for me under iOS 4.3 BUT the key "UIStatusBarHidden" and then setting it's type to Boolean and checking the box did the trick.

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW4

This developer article got me onto the Info.plist keys and then working out the equivalent key for hiding it wasn't too hard.

Interestingly the "UIStatusBarStyle" needs to use the enumeration name as a string for it to work.

Josh Peak
  • 5,898
  • 4
  • 40
  • 52
3

write this 1 line in to your main .m viewDidload method

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

or select info.plist file from your project supporting files folder in workspace

set statusbarinitialyhidden to YES

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Usman
  • 31
  • 2
2

is deprecated

setStatusBarHidden:(BOOL) animated:(BOOL) 

is the correct

setStatusBarHidden:(BOOL) withAnimation:(UIStatusBarAnimation)

UIStatusBarAnimation which can be:

UIStatusBarAnimationNone or UIStatusBarAnimationFade or UIStatusBarAnimationSlide

1

This worked for me in the info.plist:

"View controller-based status bar appearance"  -> set to NO
user2588945
  • 1,681
  • 6
  • 25
  • 38
1

Add Status bar is initially hidden to YES in the info.plist file. This worked for me.

status bar hidden

Vinoth Vino
  • 9,166
  • 3
  • 66
  • 70
0

For XML editors ~ add to first child of

<key>UIStatusBarHidden</key>
<true/>
Paweł Brewczynski
  • 2,665
  • 3
  • 30
  • 43