Status bar won't disappear

HiddenStatusbarIos7Xcode5

Hidden Problem Overview


I'm creating an application and I want the status bar hidden. When I test the app, the status bar is hidden whilst the splash screen is shown, but once the app is fully loaded, the status bar reappears.

I'm using Xcode 5 and iOS 7, and have tried disabling the status bar programatically

  ([[UIApplication sharedApplication] setStatusBarHidden:YES    
      withAnimation:UIStatusBarAnimationFade];),

in the info.plist file, and using the attributes inspector on the .xib file. Nothing appears to work.

Any ideas?

Hidden Solutions


Solution 1 - Hidden

Try adding the following method to your app's root view controller:

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

Solution 2 - Hidden

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

This will enable you to set the status bar to hidden mode. This sets it to a global unlike other provided answers.

UPDATE: If you want that the status bar would be hidden on splash screen don't forget to mark "Hide during application launch" on target status bar options. Also, you can add "Status bar is initially hidden" to "YES" on the plist if you don't want to do it with code inside the app.

Solution 3 - Hidden

The code you posted works for iOS 6.1 and below. For iOS 7, Apple has made new methods available to directly control the status bar for each view. Turning off this option in your Info.plist will enable you to hide the status bar, at least for the current Developer Preview (4).

Add this and set to NO

For reference, please take a look at the iOS 7 transition guide that's available on Apple's developer portal.

Solution 4 - Hidden

well I try hide the status bar in all my app and in the "app"-info.plist and I add two rows in the dictionary "Information Property List" I add "View controller-based status bar appearance" set NO and in "Status bar is initially hidden"set YES and for me works n_n'

plist info

Solution 5 - Hidden

However, if you use UIImagePicker, the status bar appears again.

In that case, you should hide the status bar as below,

- (void)imagePickerController:(UIImagePickerController *)aPicker didFinishPickingMediaWithInfo:(NSDictionary *)info {

// for iOS7
    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
        
        [[UIApplication sharedApplication] setStatusBarHidden:YES];
    }

Solution 6 - Hidden

After some long searching, I finally found a very simple solution which also takes care of the UIImagePickerController problem.

As mentioned in the other answers, set your status bar hidden in your AppDelegate didFinishLaunching, and set the "View controller-based status bar appearance" to NO.

Then, in your AppDelegate:

- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame
{
      [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
}

et voila - your Status Bar will remain hidden even when the UIImagePickerController is foremost.

This is better than 'rehiding' it every time you present a UIImagePickerController as it remains hidden throughout the app.

Solution 7 - Hidden

To hide the status bar on a particular UIViewController, simply add this:

-(BOOL)prefersStatusBarHidden
{
    return YES;
}

Hope this helps !

Solution 8 - Hidden

You can hide from the project summary. there is a checkbox hide during launch.

See the snapshot

enter image description here

Solution 9 - Hidden

I found this solution for me. It works like a charm. Write this code on your viewcontroller which you wanted to use UIImagePickerController on.

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

Solution 10 - Hidden

In addition to the answer from alones above, make sure to implement the imagePickerControllerDidCancel method and add the same code there too.

Solution 11 - Hidden

I was having issues with UIImagePicker as well. Similar to Alones answer, my solution was the following. I added this line or code:

[[UIApplication sharedApplication] setStatusBarHidden:YES];

to this function:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated

I haven't tested this with iOS 6 or older but it works great in iOS 7.

Solution 12 - Hidden

> Swift Solution > ---------------

just add this to your view controllers:

override func prefersStatusBarHidden() -> Bool {
    return true
}

Solution 13 - Hidden

I am using Xcode 6, this solution works on iOS 7 and 8 for me:

First, Set the "View controller-based status bar appearance" to NO in plist file.

Second, in AppDelegate, add this:

- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame
{
      [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
}

Solution 14 - Hidden

My problem was that I used view controller containment. Only the top most view controller, which is embedded into a navigation controller for example, can hide or show the status bar.

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
Questionuser2397282View Question on Stackoverflow
Solution 1 - HiddenQuentinView Answer on Stackoverflow
Solution 2 - HiddenIdanView Answer on Stackoverflow
Solution 3 - HiddenSvenView Answer on Stackoverflow
Solution 4 - Hiddenuser_Dennis_MostajoView Answer on Stackoverflow
Solution 5 - HiddenalonesView Answer on Stackoverflow
Solution 6 - HiddenikuramediaView Answer on Stackoverflow
Solution 7 - HiddenMike GledhillView Answer on Stackoverflow
Solution 8 - Hiddensohail.hussain.dynView Answer on Stackoverflow
Solution 9 - HiddenxevserView Answer on Stackoverflow
Solution 10 - HiddenSwindlerView Answer on Stackoverflow
Solution 11 - HiddenDev01View Answer on Stackoverflow
Solution 12 - HiddenDan BeaulieuView Answer on Stackoverflow
Solution 13 - HiddenRRNView Answer on Stackoverflow
Solution 14 - HiddentestingView Answer on Stackoverflow