问题描述
我正在寻找有关如何更改statusBar iOS13 Objective-C的背景颜色的信息。
当我尝试以下代码时,它在IOS 13上不起作用((按预期在IOS 12上可以工作)
- (void)viewDidLoad {
...
if (@available(iOS 13.0,*)) {
UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame];
statusBar.backgroundColor = [UIColor colorWithRed:0 green:1 blue:1 alpha:1.0];
[[UIApplication sharedApplication].keyWindow addSubview:statusBar];
} else {
// Fallback on earlier versions
UIView *statusBar = (UIView *)[[UIApplication sharedApplication] valueForKey:@"statusBar"];
statusBar.backgroundColor = [UIColor colorWithRed:0 green:1 blue:1 alpha:1.0];
}
...
}
我用这个问题作为参考:How to change the status bar background color and text color on iOS 13?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)