ios - 状态栏在模拟指标中改变颜色 swift ios

标签 ios xcode swift

我想通过模拟指标更改状态栏颜色,但是,当我选择 View Controller 并将状态栏设置为浅色内容时,没有任何变化。我应该在代码中执行此操作还是通过这种方式设置状态栏颜色做错了什么?

最佳答案

使用此代码,

应用程序委托(delegate):

didFinishLaunchingWithOptions: method

UIApplication.sharedApplication().statusBarStyle = .LightContent

如果您显示特定的 ViewController,请使用下面的代码,

选择ViewController文件,viewDidLoad方法,使用此代码,

UIApplication.sharedApplication().statusBarStyle = .LightContent

希望对你有帮助

关于ios - 状态栏在模拟指标中改变颜色 swift ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37984421/

相关文章:

ios - 在 Swift 中,当 false 意味着 true

ios - Swift map 套件注解

ios - 无法识别的选择器发送到 ios 教程上的实例

iphone - ARC 语义问题 : No visible @interface for Class declares the selector

ios - UIBarButtonItem 是用淡色着色的。我可以按原样显示吗?

ios - UITableView 顶部的白色背景

ios - 为什么 Xcode 只在设置另一个约束后才提示缺少约束

ios - 为什么 UITableView 根据其默认 rowheight(44) 而不是自定义 rowHeight 来计算其 contentSize

ios - 淡化状态栏文本而不删除状态栏本身

ios - Swift 5 : Why swift 5 update ask to forcibly unwrap the label. 字体?