如何更改statusBar IOS13 Objective-C的背景颜色

问题描述

我正在寻找有关如何更改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];
    }
...
}

enter image description here

我用这个问题作为参考:How to change the status bar background color and text color on iOS 13?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...