Change color of UINavigationController back button(更改 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 后退按钮的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:更改 UINavigationController 后退按钮的颜色
基础教程推荐
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
