- (UIStatusBarStyle)preferredStatusBarStyle {
if (@available(iOS 13.0, *)) {
return UIStatusBarStyleLightContent;
} else {
return UIStatusBarStyleLightContent;
}
} - (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self setupStatusBarColor:[UIColor whiteColor]];
} - (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self setupStatusBarColor:[UIColor blackColor]];
} - (void)setupStatusBarColor:(UIColor *)color
{
if (@available(iOS 13.0, *)) {
if (!_statusBar) {
UIWindow *keyWindow = [UIApplication sharedApplication].windows[];
_statusBar = [[UIView alloc] initWithFrame:keyWindow.windowScene.statusBarManager.statusBarFrame];
[keyWindow addSubview:_statusBar];
}
} else {
_statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
}
if ([_statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
_statusBar.backgroundColor = color;
}
} - (void)dealloc{
NSLog(@" dealloc ");
if (@available(ios 13.0, *)) {
if (_statusBar) {
[_statusBar removeFromSuperview];
_statusBar = nil;
}
}
}

【iOS13问题】修改状态栏的颜色(亲测,有效)的更多相关文章

  1. 如何在RHEL7或CentOS 7系统下修改网卡名称(亲测有效~!)

    亲测有效的更改RHEL7或CentOS 7的网卡名称的方法, 按照以下4步来操作就可以实现! Step 1 :网卡配置文件名称重命名为eth0[root@localhost ~]# ifconfige ...

  2. Android中修改状态栏的颜色和我们App的风格一致

    其实也没什么东西,就是一个主题,下面看代码: <resources> <!-- Base application theme. --> <style name=" ...

  3. windows10不能修改hosts解决方案(亲测)

    hosts文本解释: 有时候我们要破解一些软件与服务器通讯,所以通常都需要更改Hosts文件来达到目的,XP系统可以直接修改保存,但是Win10系统却提示没有权限去修改,那么我们要怎样办呢,我们修改的 ...

  4. linux篇-linux修改网卡名(亲测有效)

    1查看网卡ip addr 2cd /etc/sysconfig/network-scripts Ls查看 3mv ifcfg-eno16777736 ifcfg-eth0重命名,然后编辑 最后一行加入 ...

  5. Flutter修改状态栏颜色以及字体颜色

    Flutter沉浸式状态栏 void main() { runApp(MyApp()); if (Platform.isAndroid) { // 以下两行 设置android状态栏为透明的沉浸.写在 ...

  6. Android系统更改状态栏字体颜色

    随着时代的发展,Android的状态栏都不是乌黑一片了,在Android4.4之后我们可以修改状态栏的颜色或者让我们自己的View延伸到状态栏下面.我们可以进行更多的定制化了,然而有的时候我们使用的是 ...

  7. IOS8修改状态栏颜色

    IOS8修改状态栏颜色 http://blog.csdn.net/suelu/article/details/43701913 使用了storyboard,直接view controller里面设置s ...

  8. 在iOS7中修改状态栏字体的颜色-b

    状态栏的字体为黑色: UIStatusBarStyleDefault 状态栏的字体为白色: UIStatusBarStyleLightContent 一.在 info.plist  中,将 View ...

  9. iOS7状态栏字体颜色修改

    iOS7中,默认的状态栏字体颜色是黑色的,如何修改为其它颜色呢? 1.在项目的*info.plist中增加 View controller-based status bar appearance 属性 ...

随机推荐

  1. luogu P1327 数列排序

    题目描述 给定一个数列{an},这个数列满足ai≠aj(i≠j),现在要求你把这个数列从小到大排序,每次允许你交换其中任意一对数,请问最少需要几次交换? 输入格式 第一行,正整数n (n<=10 ...

  2. 升级xcode10.0, 终端运行 运行报错:Print: Entry, “:CFBundleIdentifier”, Does Not Exist

    目录 问题原因 解决方法 终端解决 Print: Entry, ":CFBundleIdentifier", Does Not Exist 第一步: 去官网GitHub下载对应包就 ...

  3. Mysql基础01-语法

    数据库 数据的存储:将数据放到表中,表再放到库中. 一个数据库中可以有多个表,每个表都有一个名字,用来标识自己.表名具有唯一性. 表由列组成,我们也称为字段.每个字段描述了它所含有的数据的意义表由列组 ...

  4. [TimLinux] JavaScript 取消异步请求

    1. xhr.abort() 这个函数可以用来取消XMLHttpRequest()发起的异步请求,不是xhr.close()哦. 2. 场景 比如说,在关闭一个模态框后,数据可能还没有过来,这个时候需 ...

  5. python优势之通过一段代码来了解python的强大之处

    晚上闲暇之余随意翻了一下博客,看到https://www.jianshu.com/p/69bf0ed0b5cc作者提到了一段代码,刚开始看没啥感觉,仔细深入后引起了我的注意.里面使用了python最简 ...

  6. POJ-1743 Musical Theme(最长不可重叠子串,后缀数组+二分)

    A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the ...

  7. firefox浏览器写xpath

    最近在学xpath发现Firefox浏览器不支持xpath定位页面元素 百度为例: F12 页面前端代码  输入最简单的xpath发现并不能定位元素 解决方案:添加 Try Xpath 这个插件,因为 ...

  8. 【Visual Studio Code】插件

    [Visual Studio Code]插件 转载:https://www.cnblogs.com/yangchongxing/p/10625628.html 目录 ================= ...

  9. 【Java Web开发学习】Spring MVC异常统一处理

    [Java Web开发学习]Spring MVC异常统一处理 文采有限,若有错误,欢迎留言指正. 转载:https://www.cnblogs.com/yangchongxing/p/9271900. ...

  10. java获取每月的第一天和最后一天

    // 获取当前年份.月份.日期 Calendar cale = null; cale = Calendar.getInstance(); // 获取当月第一天和最后一天 SimpleDateForma ...