【问题标题】:change the navigationbar backgroundcolor for a tabbarcontroller更改标签栏控制器的导航栏背景颜色
【发布时间】:2016-01-14 22:02:33
【问题描述】:

我的 UI 只是从 TabBarController A 到 TabBarController B,这两个 TabBarController 具有不同的子项。现在我想更改 TabBarController B 的导航栏背景颜色,但是后面的任何方法都不起作用。

tabBarViewControllerA.navigationController.navigationBar.backgroundColor = [UIColor yellowColor]; babBarViewControllerB.navigationController.navigationBar.backgroundColor = [UIColor yellowColor]; babBarViewControllerB.childViewControllers.firstObject.navigationController.navigationBar.backgroundColor = [UIColor yellowColor];

另外,从 debug->view debugging->capture view hierarchy,我可以看到导航栏的背景颜色发生了变化,但最终颜色没有变化。 请给我一些关于这个问题的想法。

【问题讨论】:

    标签: ios uinavigationcontroller uitabbarcontroller uinavigationbar


    【解决方案1】:

    发现只需要更改navigationbar.bartintcolor

    【讨论】:

      【解决方案2】:

      试试这个。

       self.navigationController.navigationBar.barTintColor = [UIColor orangeColor];
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-08-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-08-12
        • 1970-01-01
        相关资源
        最近更新 更多