1

I was trying to hide my status bar in iOS 7 (not in iOS6) and did all the things whatever we need to do for this i.e. In plist,

Status bar is initially hidden=YES

and

View controller-based status bar appearance=NO

and in

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

I used

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

but it didn't work at all so can anyone diagnose the problem? It may be duplicate question but any other answer didn't help me. One more notable thing here is I used UIImage Picker in my application. Any help will be appreciated!!!

sam
  • 117
  • 10

3 Answers3

1

try this code working for me

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


- (BOOL)prefersStatusBarHidden
{
 return YES;
}
0

Trying like this can help you, it will compile for iOS7 or greater version.

Add this to your view controller, or if you have some base view controller than add this method there.

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

#endif
NeverHopeless
  • 11,077
  • 4
  • 35
  • 56
0

Do only three things

  1. [application setStatusBarHidden:YES]; in delegate didFinishLaunchingWithOptions
  2. View controller-based status bar appearance=NO
  3. status bar is initially hidden=YES

I run using this code I am not getting satatusbar visible in ios 7.1

Pandey_Laxman
  • 3,889
  • 2
  • 21
  • 39
  • come on!!!this was my problem and I did exactly these things to hide my status bar. Any thing else you can suggest me to do the need full? – sam Apr 02 '14 at 13:07