Andrew Nguyen
Andrew Nguyen

Reputation: 1

fix error hidding status bar on ios 7

![Error hidden satus bar on ios 71

I'm problem when working on ios 7.
1. I'm want hidden status bar on ios7 when it build from xcode 4.6.
2.App current is run on device ios 7 but status bar of Camera roll show a version older of ios.

Can you help me about problem above?
Thanks so much.

Upvotes: 0

Views: 173

Answers (1)

Dhaval Bhadania
Dhaval Bhadania

Reputation: 3089

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;
  }

in iOS 7

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

UIStatusBarHidden UIViewControllerBasedStatusBarAppearance 

enter image description here

Hope it will help.

Happy coding...:)

Upvotes: 1

Related Questions