i have already checked the answer which is given in stack overflow.
like this method: prefersStatusBarHidden
-(BOOL)prefersStatusBarHidden {
return [self.navigationController prefersStatusBarHidden];
}
i have already checked the answer which is given in stack overflow.
like this method: prefersStatusBarHidden
-(BOOL)prefersStatusBarHidden {
return [self.navigationController prefersStatusBarHidden];
}
Create and import a category of navigation controller like below
#import <UIKit/UIKit.h>
@interface UINavigationController (StatusBarStyle)
- (void)setDefaultStatusBar;
- (void)setLightStatusBar;
@end
#import "UINavigationController+StatusBarStyle.h"
@implementation UINavigationController (StatusBarStyle)
BOOL isLight;
- (void)setDefaultStatusBar {
isLight=NO;
[self setNeedsStatusBarAppearanceUpdate];
}
- (void)setLightStatusBar {
isLight=YES;
[self setNeedsStatusBarAppearanceUpdate];
}
- (UIStatusBarStyle)preferredStatusBarStyle {
if (isLight) {
return UIStatusBarStyleLightContent;
}
else{
return UIStatusBarStyleDefault;
}
}
@end
And call [self.navigationController setDefaultStatusBar]
or [self.navigationController setLightStatusBar]
from your viewDidLoad or somewhere from your view controller which has a parent UINavigationController