【问题标题】:UINavigationbar barTintColor not working in UISplitview TemplateUINavigationbar barTintColor 在 UISplitview 模板中不起作用
【发布时间】:2014-10-08 11:45:42
【问题描述】:

我尝试了几个小时来更改我的应用程序中的导航栏 barTintValue。 我正在使用 Xcode 中的 Master-Detail Template 使用 Swift 和 我在这里阅读了很多问题,但答案总是使用

navigationController?.navigationBar.barTintColor = UIColor.redColor()

这在 AppDelegate 中运行良好,但我想在运行时根据其内容更改每个 DetailView 中的颜色。

当我将此代码放入 Master 或 DetailViewController 时,什么也没有发生。我打印了之前和之后的颜色,它确实设置了值,它只是没有改变。 我需要更新视图吗?

感谢您的帮助! 麦克

【问题讨论】:

    标签: ios xcode swift uinavigationbar bartintcolor


    【解决方案1】:

    与往常一样,我只是在发布此内容后立即找到了答案。 我不认为它是解决方案,而是一种解决方法。

    我在 prepareForSegue 中更改 detailView 的颜色,并在 masterViews viewWillAppear 中将其更改回默认值。

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题。 我找到了解决办法。

      navigationController?.navigationBar.backgroundColor = UIColor.redColor()
      

      【讨论】:

      • 这只会改变导航栏颜色而不是状态栏颜色
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-05
      • 2014-03-05
      相关资源
      最近更新 更多