[英]Navigationbar not filling under status bar when clicked from side menu?
I have a navigation bar created by the nav controller for my view, these are loaded via a container side menu.我有一个由导航控制器为我的视图创建的导航栏,这些导航栏是通过容器侧菜单加载的。
When i click an item, it loads the nav controller and view, but the nav bar background drops out showing a blank background colour on the status bar.当我单击一个项目时,它会加载导航控制器和视图,但导航栏背景会在状态栏上显示为空白背景色。
Any idea how I can diagnose this issue?知道如何诊断这个问题吗? I have included some view debugger screenshots to best illustrate
我已经包含了一些视图调试器屏幕截图来最好地说明
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
Well you are missing one thing here and thats setBackgroundImage of UINavigationBar.那么你在这里错过了一件事,那就是 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
*Note this is the solution for Sidemenu Library named " https://github.com/jonkykong/SideMenu/ " *注意这是名为“ https://github.com/jonkykong/SideMenu/ ”的 Sidemenu 库的解决方案
Change status bar end alpha property to 0将状态栏结束 alpha 属性更改为 0
Please find code below.请在下面找到代码。
@objcMembers
open class SideMenuPresentationStyle: InitializableClass {
/// Background color behind the views and status bar color
open var backgroundColor: UIColor = .white`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.