Ado direct teach you how to modify it
1, add categories category
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UINavigationController (StatusBarStyle)
@end
NS_ASSUME_NONNULL_END
#import "UINavigationController+StatusBarStyle.h"
@implementation UINavigationController (StatusBarStyle)
- (UIViewController *)childViewControllerForStatusBarStyle {
return self.visibleViewController;
}
- (UIViewController *)childViewControllerForStatusBarHidden {
return self.visibleViewController;
}
@end
2, modify the info file
key: Application requires iPhone environment
value: YES
3, modify the color of a controller
重写这个,返回你想要的状态,也可以用全局变量来返回,我这里是只改一次,你如果想随时改变,
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
4, update status
[self setNeedsStatusBarAppearanceUpdate];
Well, I think you have to modify successful
do not forget thumbs V_V
Reproduced in: https: //www.jianshu.com/p/3b7f6cf60432