Skip to content

Instantly share code, notes, and snippets.

@Marlunes
Created July 16, 2013 07:54
Show Gist options
  • Select an option

  • Save Marlunes/6006700 to your computer and use it in GitHub Desktop.

Select an option

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;
}
@ETiV
Copy link
Copy Markdown

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
Copy Markdown

Nice, works perfect! thanks.

@holgersindbaek
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

@moohyu cool. thank you!

@Pointcube
Copy link
Copy Markdown

@moohyu Thanks it works fine for me.

Copy link
Copy Markdown

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
Copy Markdown

Thanks - helped me out a bunch!

@Tulakshana
Copy link
Copy Markdown

This didn't work for me

@KiemDuong
Copy link
Copy Markdown

didn't work!

@cemerson
Copy link
Copy Markdown

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