- (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. 翻转二叉树(深搜-先序遍历-交换Node)

    题目:翻转二叉树,例如 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 已知二叉树的节点定义如下: class TreeNode { in ...

  2. 开发者应该掌握 WebSocekt 协议的知识

    文章介绍 WebSocket 是一种在单个 TCP 连接上进行全双工通信的协议,它的出现使客户端和服务器之间的数据交换变得更加简单.WebSocket 通常被应用在实时性要求较高的场景,例如赛事数据. ...

  3. git 使用详解(5)—— get log 查看提交历史

    git log 查看 提交历史 在提交了若干更新之后,又或者克隆了某个项目,想回顾下提交历史,可以使用 git log 命令查看. 接下来的例子会用我专门用于演示的 simplegit 项目,运行下面 ...

  4. 洛谷 P2254 [NOI2005]瑰丽华尔兹(单调栈优化DP)

    题目描述 不妨认为舞厅是一个N行M列的矩阵,矩阵中的某些方格上堆放了一些家具,其他的则是空地.钢琴可以在空地上滑动,但不能撞上家具或滑出舞厅,否则会损坏钢琴和家具,引来难缠的船长.每个时刻,钢琴都会随 ...

  5. Open-Pit Mining

    Description Open-pit mining is a surface mining technique of extracting rock or minerals from the ea ...

  6. Proxmox VE虚拟化管理平台-相关概念

    请阅读此文用户务必阅读以下链接,其中包含了汉化作者.张自然copy过来的原因等信息. www.zhangziran.com/proxmox-docs-zh-cn.htm a Proxmox VE 集群 ...

  7. 551. 学生出勤纪录 I

    给定一个字符串来代表一个学生的出勤纪录,这个纪录仅包含以下三个字符: 'A' : Absent,缺勤 'L' : Late,迟到 'P' : Present,到场 如果一个学生的出勤纪录中不超过一个' ...

  8. Electron 设置 -webkit-app-region 后无法响应鼠标点击事件的解决方式

    参考博客:https://blog.csdn.net/qq_20264891/article/details/87721163

  9. MapStruct 映射工具

    # MapStruct 映射工具  本篇主要讲解MapStruct 一款映射工具,只需简单的定义一个Mapper接口,在编译期间,MapStruct将生成此接口的实现,据说MapStruct性能最高是 ...

  10. poj 1741 Tree (树的分治)

    Tree Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 30928   Accepted: 10351 Descriptio ...