ios - 从侧面菜单单击时,导航栏未填充在状态栏下?

标签 ios swift uinavigationbar statusbar

我有一个由导航 Controller 为我的 View 创建的导航栏,这些导航栏是通过容器侧面菜单加载的。

当我单击某个项目时,它会加载导航 Controller 和 View ,但导航栏背景会消失,在状态栏上显示空白背景颜色。

知道如何诊断这个问题吗?我提供了一些 View 调试器屏幕截图来最好地说明

enter image description here

enter image description here enter image description here

enter image description here

  UINavigationBar.appearance().tintColor = UIColor.white
    UINavigationBar.appearance().barTintColor = UIColor().appThemeColour()
    UINavigationBar.appearance().isTranslucent = false
    UINavigationBar.appearance().shadowImage = UIImage()
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
    UIApplication.shared.statusBarStyle = .lightContent

最佳答案

好吧,你在这里遗漏了一件事,那就是 UINavigationBar 的 setBackgroundImage。

    UINavigationBar.appearance().tintColor = UIColor.white
    UINavigationBar.appearance().barTintColor = UIColor().appThemeColour()
    UINavigationBar.appearance().isTranslucent = false
    UINavigationBar.appearance().shadowImage = UIImage()
    UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
    UIApplication.shared.statusBarStyle = .lightContent

关于ios - 从侧面菜单单击时,导航栏未填充在状态栏下?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46586451/

相关文章:

ios - 模拟器错误 FBSSystemServiceDomain 代码 4

swift - 在 Swift 中,为什么以全局队列为目标的自定义串行队列不能同时执行?

ios - 将 accessToken 存储在 iOS 钥匙串(keychain)中

ios - 导航栏中的 SearchController 问题

ios - 如何获取 iOS 10 watch 导航栏的颜色和半透明度?

iphone - 持久化 UINavigationItem 的 rightBarButtonItem 属性

ios - 将 Realm 查询结果用作UITableView节标题

iOS:如何使用多个内插参数本地化字符串?

ios - 如何从 iOS 上的另一个应用程序打开 Google Play 音乐应用程序?

ios - 编程 .beginRefresh() 不刷新 UITableView 中的数据