1

I tried to hide status bar in iOS7 by putting this:

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

in delegate or in mainview

But it's not working!

It was working in iOS6

AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210

7 Answers7

4

Either set "View controller-based status bar appearance" to NO in your info plist or add this code in your view controllers:

-(BOOL)prefersStatusBarHidden
{
    return YES;
}
Felix
  • 35,354
  • 13
  • 96
  • 143
  • including this methods generates the error message "user of undeclared identifier prefersStatusBarHidden – vboombatz Mar 25 '14 at 15:02
2

Add the following to your Info.plist:

UIStatusBarHidden UIViewControllerBasedStatusBarAppearance

or follow this link http://www.openfl.org/developer/forums/general-discussion/iphone-5ios-7-cant-hide-status-bar/

yen
  • 772
  • 3
  • 10
0

In a viewController where you want to hide status bar add:

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

In viewDidLoad

    [self prefersStatusBarHidden];
    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];

In app *-info.plist

View controller-based status bar appearance set to YES

nerowolfe
  • 4,787
  • 3
  • 20
  • 19
0

Try this.

In your iOS target -> Info, add View controller-based status bar appearance and set the value as NO.

It worked for me in iOS7. I have also set "status bar initially hidden" property to YES

slysid
  • 5,236
  • 7
  • 36
  • 59
0
//viewDidload
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
}




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

this wil work ..hope it helps

BhavikKama
  • 8,566
  • 12
  • 94
  • 164
0

In your apps plist file add a row call it " UIViewControllerBasedStatusBarAppearance" and set it to NO

from http://www.openfl.org/developer/forums/general-discussion/iphone-5ios-7-cant-hide-status-bar/, mgiroux's solution

thavasidurai
  • 1,972
  • 1
  • 26
  • 51
0

In the Plist add the following properties.

Status bar is initially hidden = YES

View controller-based status bar appearance = NO

enter image description here

now the status bar will hidden.

Gurumoorthy Arumugam
  • 2,129
  • 1
  • 25
  • 40