更改 UINavigationController 后退按钮的颜色

Change color of UINavigationController back button(更改 UINavigationController 后退按钮的颜色)
本文介绍了更改 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 后退按钮的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Get an event when UIBarButtonItem menu is displayed(显示UIBarButtonItem菜单时获取事件)