Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6.x/iOS 8 Hides Status Bar in Landscape Orientation

Tags:

ios

iphone

xcode6

Application build with Xcode 6.x automatically hides the status bar in Landscape orientation (iPhone). The same application when compiled with Xcode 5.x doesn't do that.

How can I prevent the application from hiding the status bar in Landscape orientation? Basically, how can I disable this "super awesome" feature that Apple/Xcode has shoved down my throat?

p.s. I've tried updating the view controllers with the following code, but it doesn't help.

- (BOOL)prefersStatusBarHidden {
    return NO;
}
like image 836
Mustafa Avatar asked Oct 21 '14 12:10

Mustafa


2 Answers

Best possible solution

It's basically a two step process:

1). Set "View controller-based status bar appearance" to NO, in your project's Info.plist file.

2). Force the status bar hidden status to NO, in application:didFinishLaunchingWithOptions:, using the following code:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

And, voila!

Note: It's important to use both the setStatusBarHidden:withAnimation: statements above, to force the status bar hidden state.


Reference: On iOS8, displaying my app in landscape mode will hide the status bar but on iOS 7 the status bar is displayed on both orientations

like image 103
Mustafa Avatar answered Nov 15 '22 19:11

Mustafa


I'm using

#define IS_IOS8 SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")

-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
    [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];

    if (IS_IOS8){
            [[UIApplication sharedApplication] setStatusBarHidden:NO];
    }
}
like image 24
Phillip Avatar answered Nov 15 '22 19:11

Phillip