动态调整statusBar颜色
整体修改(整个APP状态栏)
- 将infoPlist里 View controller-based status bar appearance 设置为NO
2.通过代码 进行设置
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
局部修改
- 将infoPlist里 View controller-based status bar appearance 设置为YES
// 通过viewController 控制
- (UIStatusBarStyle)preferredStatusBarStyle {
if (_alpha >= 1) {
return UIStatusBarStyleDefault;
} else {
return UIStatusBarStyleLightContent;
}
}
// 需要更新时调用
[self setNeedsStatusBarAppearanceUpdate];