Cannot Hide Status Bar


#1

It seems pretty straight forward. I added the last two lines of the following code but I am still seeing a status bar. I also changed the key “Status bar is initially hidden” to value “YES”. Still there. What am I missing? Thanks in advance.

HypnosisterAppDelegate.m

[code]- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.

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

#2

Are you targeting iOS7? I have the same issue and when I Google the problem it seems there is a change on iOS7 that affects this.

One of the suggestions here may help…
http://stackoverflow.com/questions/18059703/cannot-hide-status-bar-in-ios7


#3

Yes, iOS7. Good call. I will mess around with some of the suggestions. Thanks AndyWW.


#4

Let me know if you mange to fix it. I’m soldiering on for now and ignoring it but I’d like to know how to fix it up at some point.


#5

Add and change the key “View-Controller Based Status Bar Appearance” to value “NO”. The app now responds to the code we added in HypnosisterAppDelegate.m (including the Fade Animation).


#6

Ah yes - much better!


#7

Another way to do it, at the ViewController level:

-(BOOL)prefersStatusBarHidden { return YES; }

-Craig


#8

Craig - how and where do i implement that new method? and do i need to call it from anywhere in particular?


#9

Well, it overrides a UIViewController method, so it would go in your view controller. And it would automatically be called as part of the view controller’s setup.

Unfortunately, this app doesn’t have a View Controller.

2014-02-22 16:47:56.288 Hypnosister[14132:70b] Application windows are expected to have a root view controller at the end of application launch

I guess my answer doesn’t help for this chapter. :unamused:

-Craig