设置状态栏字体颜色时,无论怎样设置就是不起作用,用下面的方法才解决问题:
先在info.list 中设置
View controller-based status bar appearance = NO
然后设 状态栏 字体颜色是 白色还是黑色
UIApplication.shared.statusBarStyle = UIStatusBarStyle.default;
OR
UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent;
Swift
override var preferredStatusBarStyle: UIStatusBarStyle {
return .darkContent
}
OC
#pragma mark 默认状态栏
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleDarkContent;
}
- (BOOL)prefersStatusBarHidden {
return NO;
}
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation {
return UIStatusBarAnimationNone;
}
网友评论