如何在互联网可达性上使用带有swift的ios更改状态栏颜色? [英] How to Change the status bar color using ios with swift on internet reachability?

查看:103
本文介绍了如何在互联网可达性上使用带有swift的ios更改状态栏颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改设备状态栏的颜色如果互联网已连接,状态栏颜色应变为黑色,如果互联网未连接,颜色或状态栏应变为红色,以便表明互联网正在工作或者在使用SWIFT使用应用程序期间没有...帮助我

i want to change the color of my device status bar if the internet is connected than the status bar color should turn Black and if the internet is not connected the color or status bar should turn Red so that it indicates wether internet is working or not during working with the application using SWIFT...help me out

推荐答案

信息中。 plist 您需要将查看基于控制器的状态栏外观设置为布尔值。

In your Info.plist you need to set "View controller-based status bar appearance" to a boolean value.

如果将其设置为 YES 然后你应该在每个视图控制器中覆盖 preferredStatusBarStyle 函数。

If you set it to YES then you should override preferredStatusBarStyle function in each view controller.

如果你将它设置为然后你可以使用以下方式在 AppDelegate 中设置样式:

If you set it to NO then you can set the style in AppDelegate using:

UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)

这篇关于如何在互联网可达性上使用带有swift的ios更改状态栏颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆