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

I want the status bar to be displayed in both orientations in iOS 8; it's being displayed properly in iOS 7.

navigationController.isNavigationBarHidden returns NO.

Why is iOS 8 doing this?


Solution 1:

Try this

Add below code in didRotateFromInterfaceOrientation

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

EDIT
NO NEED TO WRITE CODE IN ALL VIEW CONTROLLER
Set View controller-based status bar appearance to NO in plist and add below code in root view controller's viewDidLoad

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

Demo project
https://www.dropbox.com/s/uumneidk4wom5md/demoStatusBar.zip?dl=0

Solution 2:

To display status bar in landscape mode in ios 8, try following method

- (BOOL)prefersStatusBarHidden {
    return NO;
}

Swift version

override func prefersStatusBarHidden() -> Bool {
    return false
}

Swift 3, Xcode 8, iOS 10, /* ViewController.swift */

override var prefersStatusBarHidden: Bool {
        return false
    }