12

I am getting REALLY frustrated!!

I have tried every living possibility to get rid of the UIStatusBar at the top of my app...

I have tried:

  • Setting Status Bar to "None" in IB

  • Running [[UIApplication sharedApplication] setStatusBarHidden:YES]; on application launch AND in each scene.

  • Going to the .plist and changing the value for Status Bar Hidden at Startup: YES

  • Setting that same value on the home page for the target

  • Setting - (BOOL)prefersStatusBarHidden { return YES; } in the app delegate

Literally none of this works... It still shows up on all of my views, and it is SUPER frustrating

Thanks again :)

Side note: I'm in xcode 5, developer beta iOS 7 beta 6, but this also happens on my old ios6 and xcode 4 apps

rmaddy
  • 314,917
  • 42
  • 532
  • 579
tyler53
  • 429
  • 1
  • 5
  • 16
  • [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; from http://stackoverflow.com/questions/5709123/ios-4-3-hide-status-bar-permanently\ – iPatel Aug 30 '13 at 05:59
  • If you see my post, I already tried that, but thank you for the suggestion :) – tyler53 Aug 30 '13 at 14:38
  • You can also add "View controller-based status bar appearance" and set it to "NO" in your info.plist file as shown in this post: http://stackoverflow.com/questions/17763719/status-bar-wont-disappear – jsherk Sep 24 '13 at 20:22
  • Had a look at Bram's answer? Looks a lot simpler to me than the 'correct answer'. Works for me. –  Jan 06 '14 at 11:49

4 Answers4

20

Please try this

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


// Add this Method
- (BOOL)prefersStatusBarHidden
{
return YES;
}

This code has been taken from this link

Vaibhav Gautam
  • 2,074
  • 17
  • 17
15

What I usually do is add two key-value properties to the Info.plist file.

enter image description here

The properties source code is:

enter image description here

German Attanasio
  • 22,217
  • 7
  • 47
  • 63
  • 2
    One thing everyone fails to emphasize upon is that "View controller-based status bar appearance" is a `BOOLEAN` value. Mine was set to String, and I almost tore my hair out. – n00bProgrammer Dec 13 '13 at 10:11
  • 2
    You really should avoid disabling view-controller based status bar appearance. This is merely a compatibility option added to make old apps work under iOS 7 when developers have no time or are unable to implement the new way of things. – lhunath Jan 14 '14 at 19:17
4

You need to add a method to the view controller, and not to the app delegate as you write.

- (BOOL)prefersStatusBarHidden
{
    return YES;
}
Bram
  • 7,440
  • 3
  • 52
  • 94
3

As something occured to me!!

for anyone else ,, Make sure you are modifying the info.plist in the right *TARGET* :/

plus the accepted answer.

M.Othman
  • 5,132
  • 3
  • 35
  • 39