【问题标题】:Navigation Controller with translucent effect具有半透明效果的导航控制器
【发布时间】:2016-11-18 18:13:39
【问题描述】:

我的应用在导航控制器方面存在问题。在我用变色龙设置主题并用 facebook 登录之后。我的应用转至 initialView,但导航控制器外观错误。

正确的是

我尝试定义条形样式、半透明、背景颜色等等。

Ps:第一张图中的图标是蓝色的,因为我设置了导航栏的 bartintcolor。

那么,我能做些什么呢?

【问题讨论】:

  • 你能把代码贴在你设置UINavigationController栏颜色的地方吗?
  • 首先,在 facebook 登录之前:Chameleon.setGlobalThemeUsingPrimaryColor(nil, withSecondaryColor: nil, andContentStyle: UIContentStyle.Dark) 并且在 facebook 登录正确之后:Chameleon.setGlobalThemeUsingPrimaryColor(myColor, withContentStyle: .Contrast )
  • SO上关于translucentEffect的问题有很多,请先查询并参考。

标签: ios swift uinavigationcontroller uinavigationbar


【解决方案1】:

这是我的 sn-p,它应该在 Swift 3 中工作。

    navigationController?.navigationBar.isTranslucent = true
    navigationController?.navigationBar.tintColor = UIColor.white
    navigationController?.navigationBar.barTintColor = UIColor(colorLiteralRed: 0.113725, green: 0.450980, blue: 0.890196, alpha: 1)// Set to any colour   

输出:

【讨论】:

    【解决方案2】:

    你有没有尝试过

    navigationController?.navigationBar.setBackgroundImage(nil, forBarMetrics:UIBarMetrics.Default)
    navigationController?.navigationBar.translucent = false
    navigationController?.navigationBar.shadowImage = nil
    

    【讨论】:

    • 发生这种情况:s15.postimg.org/t19fuq3kr/…。我尝试再次定义背景颜色,但什么也没有。现在一切都是白色的。
    • 对不起,我忘了写一行,我已经编辑了答案
    • 还没有。全白...:/
    猜你喜欢
    • 1970-01-01
    • 2021-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-16
    • 1970-01-01
    • 1970-01-01
    • 2017-04-26
    相关资源
    最近更新 更多