更改UINavigationController后退按钮的颜色 [英] Change color of UINavigationController back button

查看:53
本文介绍了更改UINavigationController后退按钮的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试找出如何更改导航控制器上按钮的颜色时遇到问题.

I'm having problems trying to figure out how to change the color of the buttons on the navigation controller.

以前我使用过以下内容:

Previously I had used the following:

[[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:226/255.0 green:66/255.0 blue:66/255.0 alpha:0.0]];

,此方法有效,但是我添加了带有工具栏的新视图,并且工具栏按钮图像不会显示.如果我删除了全局着色,则工具栏项显示得很好.

and this worked, but I added a new view with a toolbar, and the tool bar button images will not show. If I remove the global coloring, the tool bar items show just fine.

我尝试在视图的 viewDidLoad 方法中的 leftBarButtonItem backBarButtonItem 上设置色彩颜色,但是这些属性似乎为空.

I've tried setting the tint color on both the leftBarButtonItem and the backBarButtonItem in the viewDidLoad method of the view, but both of those properties appear to be null.

我不想更改整个导航栏的颜色,只需更改按钮即可.有办法吗?

I don't want to change the color of the entire navigation bar, just the buttons. Is there a way to do this?

推荐答案

是的,我将其发布为答案.您的Alpha设置为0.因此,您基本上是在说[UIColor clearColor].不确定该如何在条形按钮项目上为您提供淡淡的颜色.

Yeah, I'll just post this as an answer. Your alpha is set to 0. So you're basically saying the same thing as [UIColor clearColor]. Not sure how that ever worked to give you a tint color on your bar button items.

这篇关于更改UINavigationController后退按钮的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆