- (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. springcloud+kafka集群

    上节说了kafka在linux环境下怎么搭建集群.这节写一下怎么在springcloud中以stream流方式去做kafka集群对接. 1.yml配置 #spring Cloud kafka -- s ...

  2. hibernate查询方式(四)

    ---恢复内容开始--- 1.mysql中的多表联合查询 ****/*内连接查询*/  只显示两个表有关联的记录 //第一种 SELECT * FROM Class c ,Student s WHER ...

  3. Creating your first iOS Framework

    转自:https://robots.thoughtbot.com/creating-your-first-ios-framework If you’ve ever tried to create yo ...

  4. CodeForces-999A-Mishka and Contest

    Mishka started participating in a programming contest. There are nn problems in the contest. Mishka' ...

  5. 28. 实现strStr() (双指针)

    实现 strStr() 函数. 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始).如果不存在,则返 ...

  6. IPV6技术笔记(剖析IPv4toIPv6)

    IPV6技术笔记 IPv6地址入门概念 什么是IPv6? IPv6,全称Internet Protocol version 6,即网际协议版本6,也叫互联网通信协议第六版.是互联网工程任务组(IETF ...

  7. 使用CleanWebpackPlugin插件报错原因:CleanWebpackPlugin is not a constructor

    // webpack版本:4.32.2 // 抛错原写法 const CleanWebpackPlugin = require("clean-webpack-plugin"); . ...

  8. Vue中使用keep-alive优化网页性能

    用keep-alive包裹路由 当前数据第一次访问时,会被缓存到浏览器缓存当中,若数据无更替,则直接读取缓存中的数据. 使用keep-alive时会存在一个activated的生命周期钩子 只有在la ...

  9. SpringMVC深入浅出(一)

    1.Springmvc是什么 是一个表现层框架,用于接受请求及参数,响应请求回显数据. 2.SpringMVC处理流程 SpringMVC流程 1.  用户发送请求至前端控制器DispatcherSe ...

  10. 2019 ECfianl

    这真的是一次失败的旅行,不过也有所收获. 我也是醉了,真的是,热身赛的时候对面队伍把B题快快的过了,就开始在那里说个不停,真的是超级烦(以为他们是个大佬队) 第二天正式赛了,他们过了两题,就没有了,( ...