【发布时间】:2018-07-27 01:19:49
【问题描述】:
Dashboard 是一个 UINavigationController 作为根视图控制器。我在 AppDelegate 中放了几行使其透明:
let barAppearace = UIBarButtonItem.appearance()
barAppearace.setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -400), forBarMetrics:UIBarMetrics.Default)
barAppearace.setTitleTextAttributes(["NSFontAttributeName":UIFont.customFontOfSize(14, style: FontName.kHelveticaNeue)], forState: .Normal)
barAppearace.tintColor = UIColor.whiteColor()
UINavigationBar.appearance().backgroundColor = UIColor.clearColor()
UINavigationBar.appearance().barTintColor = UIColor.clearColor()
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: .Default)
当我从仪表板推送视图控制器时,推送的视图控制器导航栏颜色变为黑色。
我想要与仪表板导航栏相同的外观。我已经完成了已经回答的问题。但仍然没有运气。
【问题讨论】:
-
添加一些代码。你是如何尝试改变颜色的?
-
看一次可能对你有帮助:stackoverflow.com/questions/25845855/…
-
在仪表板屏幕上它工作正常。但是当我从仪表板屏幕推送视图控制器时。新推送的控制器导航栏颜色变为黑色。
-
否则显示您的代码
-
@Anbu.karthik 编辑问题并包含代码。
标签: ios swift xcode colors uinavigationbar