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

查看:21
本文介绍了更改 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 方法中设置 leftBarButtonItembackBarButtonItem 的色调颜色,但两者这些属性似乎为空.

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天全站免登陆