简体   繁体   English

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

[英]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.

相关问题 Swift iOS - 在状态栏下设置 CollectionView 框架时,NavigationBar hidesBarsOnSwipe 永远不会重新出现 - Swift iOS -NavigationBar hidesBarsOnSwipe never reappears when setting CollectionView Frame under Status Bar 当提供自定义侧面菜单时,如何隐藏状态栏的一部分 - How to hide part of status bar, when custom side menu presented 从横向来时状态栏下的NavigationBar - NavigationBar under statusbar when comming from landscape 用户在通话状态栏中时,NavigationBar布局有异常 - NavigationBar Layout has an exception when user has in call status bar 如何从选项卡栏下面的侧菜单(SWRevealviewcontroller)中打开视图控制器,以使选项卡栏不应该隐藏在底部? - how to open the viewcontroller from the side menu(SWRevealviewcontroller) under the tab bar so that the tab bar should not be hidden at the bottom? Google自定义状态栏和导航栏登录控制器 - Custom status bar and navigationbar from Google sign in controller iOS 7状态栏与NavigationBar发生碰撞 - iOS 7 Status Bar Collides With NavigationBar 当从状态栏隐藏的viewController中使用向后滑动手势时,UINavigationBar将在状态栏下移动 - UINavigationBar moves under status bar when using swipe back gesture from status bar hidden viewController Swift4 侧边菜单显示黑色状态栏 - Swift4 Side Menu Shows Black Status Bar 侧面菜单如何覆盖状态栏的一部分 - how side menu can cover part of status bar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM