我有一个由导航 Controller 为我的 View 创建的导航栏,这些导航栏是通过容器侧面菜单加载的。
当我单击某个项目时,它会加载导航 Controller 和 View ,但导航栏背景会消失,在状态栏上显示空白背景颜色。
知道如何诊断这个问题吗?我提供了一些 View 调试器屏幕截图来最好地说明
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/