Skip to content

Instantly share code, notes, and snippets.

@Marlunes
Created July 16, 2013 07:54
Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save Marlunes/6006700 to your computer and use it in GitHub Desktop.
Save Marlunes/6006700 to your computer and use it in GitHub Desktop.
FORCE HIDE STATUS BAR FOR IOS 7 AND 6
//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;
}
@unnamedd
Copy link

Really nice this tip, thank you!

@vladborovtsov
Copy link

Doesn't works for me:(

@ETiV
Copy link

ETiV commented Aug 18, 2013

For iOS 7 beta, only add this method to my root view controller, and it's worked

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

@SaronGrave
Copy link

Nice, works perfect! thanks.

@holgersindbaek
Copy link

Any idea of how you would do this programatically within the app? If I want to hide and show the status bar on certain events?

@moohyu
Copy link

moohyu commented Sep 12, 2013

*info.plist add key and value.
key is "View controller-based status bar appearance".
value is 'NO"
and *info.plist saved.
run.

@Sixeight
Copy link

@moohyu cool. thank you!

@Pointcube
Copy link

@moohyu Thanks it works fine for me.

Copy link

ghost commented Sep 20, 2013

@moohyu - do I need that in addition to the code above? I still have a white bar at the bottom of my app after trying this... thanks!

@jimrutherford
Copy link

Thanks - helped me out a bunch!

@Tulakshana
Copy link

This didn't work for me

@KiemDuong
Copy link

didn't work!

@cemerson
Copy link

cemerson commented Oct 2, 2014

Yeah not working for me yet either - there seems to be more variable(s) at play here or something. Ugh - I just want to hide the thing!

Also - anyone have any luck getting something like this applied to the InAppBrowser webview? Seems like that status bar is obeying a different set of rules. At first stab these snippets don't seem to work on the CDVInAppBrowser.m file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment