我想将整个项目的状态栏设置为黑色。我的项目中有分页、模态视图、导航堆栈。有没有办法将完整项目的状态栏设置为黑色。我在 Android 应用程序中见过这个。我尝试在 AppDelegate 中将状态栏设置为 Light,在 plist 中将基于 View Controller 的导航栏设置为 NO/YES。似乎什么都不起作用。
最佳答案
调用此表单application:didFinishLaunchingWithOptions
应该可以。
func setStatusBarBackgroundColor(color: UIColor) {
guard let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
return
}
statusBar.backgroundColor = color
}
关于ios - 如何在 Swift 和 iOS 9 中使整个项目的导航栏变黑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38935633/