gpt4 book ai didi

objective-c - UIStatusBar 在 UITabBarViewController ios11 中显示为黑色

转载 作者:太空狗 更新时间:2023-10-30 03:24:34 25 4
gpt4 key购买 nike

问题很简单:

  • 应用程序基于UITabBarViewController
  • Controller 中的 3 个选项卡
  • TabBar View 在 viewDidLoad 中配置为UITabBarViewController

启动时,UIStatusBar 显示为黑色背景色 Launch Status Bar

切换到任何选项卡 UIStatusBar 都会变色!

Correct Status Bar

我错过了什么?

最佳答案

几个月前我遇到了类似的问题 - 我通过将以下行添加到我的 AppDelegate 中解决了这个问题。请在下面找到我的 swift 代码,我相信你知道 objective-c 语法:

    // Setup general NavBar appearance
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().backgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0)
UINavigationBar.appearance().isTranslucent = true
UINavigationBar.appearance().tintColor = UIColor.white
UIApplication.shared.statusBarStyle = .lightContent // => this would be the solution

我认为最后一行代码对您来说会很有趣。在您的 AppDelegate 中设置此更改很重要。

关于objective-c - UIStatusBar 在 UITabBarViewController ios11 中显示为黑色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46759623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com