导航控制器底部工具栏的颜色变化 - Changing the colour of Navigation Controller bottom toolBar

- 此内容更新于:2015-12-13
主题:

我试图改变底部栏的颜色我的导航控制器。我已经设法改变顶部导航条在我appdelegate通过添加我想应用这个底部的酒吧。

原文:

I am trying to change the colour of the bottom bar of my Navigation Controller. I have managed to change the top NavBar in my appdelegate by adding

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.688 green:0.437 blue:0.794 alpha:1.0]];

I want to apply this to the bottom bar also.

解决方案:
您可以使用它来设置外观UIToolbar好运
原文:

You can use [UIToolbar appearance] to set the appearance of UIToolbar

Good luck

解决方案:
我有同样的问题,但是可以逃脱这个通过设置一个标记为我navigationBar故事板。然后我能改变navigationBar的颜色是这样的:让navigationBar=(self.view.viewWithTag(someNumber)UINavigationBar)navigationBar。barTintColor=UIColor.blackColor()这是不理想的,除非你能保证你的视图的子视图数量小于“someNumber”。如果你能,那么这应该工作。
原文:

I had the same problem, but could escape this by setting a tag for my navigationBar in my storyboard. Then I could change the navigationBar's color like this:

let navigationBar = (self.view.viewWithTag(someNumber) as UINavigationBar) navigationBar.barTintColor = UIColor.blackColor()

This is not ideal unless you can guarantee that the number of subviews in your view is less than "someNumber". If you can though, then this should work.