方法一
info中+
View controller-based status bar appearance
设置为yes
YES
在你用到的VC中添加下面copy进你的VC中、
OC
- (UIStatusBarStyle)preferredStatusBarStyle {
if (@available(iOS 13.0, *)) {
return UIStatusBarStyleDarkContent;
} else {
// Fallback on earlier versions
return UIStatusBarStyleLightContent;
}
}
Swift
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
方法二
⚠️'setStatusBarStyle:animated:' is deprecated: first deprecated in iOS 9.0 - Use -[UIViewController preferredStatusBarStyle]
//
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
网友评论