How to hide a status bar in iOS?

IosStatusbar

Ios Problem Overview


I can hide a status bar in my app:

- (void)viewDidLoad{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
    [super viewDidLoad];
    }

When I chose my launch image and start it first time, it's status bar over a picture. How can I hide this?

Ios Solutions


Solution 1 - Ios

You need to add this code in your AppDelegate file, not in your Root View Controller

Or add the property Status bar is initially hidden in your plist file

enter image description here

Folks, in iOS 7+

please add this to your info.plist file, It will make the difference :)

UIStatusBarHidden UIViewControllerBasedStatusBarAppearance

enter image description here

For iOS 11.4+ and Xcode 9.4 +

Use this code either in one or all your view controllers

> override var prefersStatusBarHidden: Bool { > return true }

Solution 2 - Ios

Add the following code to your view controller:

if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
    // iOS 7
    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
    // iOS 6
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}

- (BOOL)prefersStatusBarHidden {
    return YES;
}

Solution 3 - Ios

What helped me is this (changing plist file):

  1. set Status bar is initially hidden = YES
  2. add row: View controller-based status bar appearance = NO

Hide StatusBar - plist settings

Solution 4 - Ios

Put this code to your view controller in which you hide status bar:

- (BOOL)prefersStatusBarHidden {return YES;}

Solution 5 - Ios

In iOS 7 status bar appearance depends on UIViewController as default. To hide status bar globally, in info.plist use NO value for UIViewControllerBasedStatusBarAppearance key and use UIApplication's setStatusBarHidden method with YES BOOL value.

Solution 6 - Ios

add this key key from dropdownlist in "info.plist" and voila you will no more see top bar that includes elements something like GSM,wifi icon etc.
enter image description here

Solution 7 - Ios

It's working for me ,

Add below code into the info.plist file ,

 <key>UIStatusBarHidden</key>
 <false/>
 <key>UIViewControllerBasedStatusBarAppearance</key>
 <false/>

Hopes this is work for some one .

Solution 8 - Ios

In info.plist

View controller-based status bar appearance NO
Status bar is initially hidden YES

In view controller.m

- (BOOL) prefersStatusBarHidden
{
    return YES;
}

Solution 9 - Ios

I am supporting iOS 5, 6, & 7. My app is iPad only. I needed to use all of the following:

[[UIApplication sharedApplication] setStatusBarHidden:YES];

View Controller:

- (BOOL)prefersStatusBarHidden{ return YES; }

Info.plist

    <key>UIStatusBarHidden</key>
    <string>YES</string>

    <key>UIStatusBarHidden~ipad</key>
    <true/>

    <key>UIViewControllerBasedStatusBarAppearance</key>
    <string>NO</string>

Solution 10 - Ios

Just check the box on Targets/Summary iPad Deployment Info and you status bar will disappear. It works on my apps.

Solution 11 - Ios

I had the same problem, but its an easy fix! Just set

status bar is initially hidden = YES

then add an row by clicking on the plus right after the text status bar is initially hidden, then set the text to

view controller-based status bar appearance

by clicking the arrows, and set it to NO

Hope this helps!

Solution 12 - Ios

Well the easiest way that I do it is by typing the following into the .m file.

- (BOOL) prefersStatusBarHidden
{
    return YES;
}

This should work!

Solution 13 - Ios

-(void) viewWillAppear:(BOOL)animated
{
     [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}

Solution 14 - Ios

A complete solution in swift, in your view controller

// you can use your own logic to determine if you need to hide status bar
// I just put a var here for now
var hideStatusBar = false
override func preferStatusBarHidden() -> Bool {
    return hideStatus
}


// in other method to manually toggle status bar
func updateUI() {
    hideStatusBar = true
    // call this method to update status bar
    prefersStatusBarHidden()
}

Solution 15 - Ios

To hide status bar for each individual view controller programmatically, use any of the following two procedures:

Procedure 1:

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

Procedure 2:

-(BOOL)prefersStatusBarHidden {
    return YES;
}

To hide status bar for the entire application, we should follow the given below procedure:

You should add this value to plist: "View controller-based status bar appearance" and set it to "NO".

Click here to view screenshot

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1680822View Question on Stackoverflow
Solution 1 - IosCharanView Answer on Stackoverflow
Solution 2 - IosHardik DarjiView Answer on Stackoverflow
Solution 3 - IosArkadyView Answer on Stackoverflow
Solution 4 - IosAleksandr Sis'ovView Answer on Stackoverflow
Solution 5 - IosAlex MarkmanView Answer on Stackoverflow
Solution 6 - IosZen Of KursatView Answer on Stackoverflow
Solution 7 - IosJaywant KhedkarView Answer on Stackoverflow
Solution 8 - Iosjeet.chanchawatView Answer on Stackoverflow
Solution 9 - IosBuvinJView Answer on Stackoverflow
Solution 10 - IosMarc MilletView Answer on Stackoverflow
Solution 11 - IosJELLYFUNView Answer on Stackoverflow
Solution 12 - IosTrentView Answer on Stackoverflow
Solution 13 - IosGaurav GilaniView Answer on Stackoverflow
Solution 14 - IoscodingrhythmView Answer on Stackoverflow
Solution 15 - IosKSRView Answer on Stackoverflow