从侧面菜单中单击时,导航栏未填充状态栏?

时间:2017-10-05 13:08:16

标签: ios swift uinavigationbar statusbar

导航控制器为我的视图创建了导航栏,这些导航栏通过容器侧菜单加载。

当我点击某个项目时,它会加载导航控制器和视图,但导航栏背景会在状态栏上显示空白背景颜色。

知道如何诊断这个问题吗?我已经包含了一些视图调试器截图以最好地说明

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

3 个答案:

答案 0 :(得分:0)

你在这里遗漏了一件事,那就是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

答案 1 :(得分:0)

*请注意,这是名为“ https://github.com/jonkykong/SideMenu/”的Sidemenu库的解决方案

将状态栏结尾的alpha属性更改为0

enter image description here

答案 2 :(得分:0)

请在下面找到代码。

@objcMembers
open class SideMenuPresentationStyle: InitializableClass {

/// Background color behind the views and status bar color

open var backgroundColor: UIColor = .white`
相关问题