如何在导航栏上设置颜色`rightBarButtonItem`? [英] How to set color `rightBarButtonItem` on navigation bar?

查看:85
本文介绍了如何在导航栏上设置颜色`rightBarButtonItem`?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在导航栏上设置完成"按钮的颜色,如下图所示:

I want to set color of "Done" button on navigation bar like this image:

尽管我已将代码设置为self.doneButton.enabled = NO;,但完成"按钮仍具有白色.它不会像图像一样改变颜色.

Although, I've set code as self.doneButton.enabled = NO; but Done button still has a white color. It does not change color like image.

如何设置代码以更改上图中的完成"按钮之类的文本颜色完成按钮? 请帮我解决这个问题.我感谢您的帮助.

How to set the code to change text color done button like Done button in the image above? Please help me to solve this problem. I appreciate your help.

推荐答案

用于更改barbutton使用的颜色

for change the color of barbutton use

目标C

self.navigationItem.rightBarButtonItem = yourRightbarbuttonName;
self.navigationItem.rightBarButtonItem.tintColor = [UIColor blueColor]; // add your color

快速

或从故事板设置

self.navigationItem.rightBarButtonItem = yourRightbarbuttonName
self.navigationItem.rightBarButtonItem.tintColor = UIColor.blueColor()

如果要显示右键"按钮,请使用

目标C

self.navigationItem.rightBarButtonItem.enabled = YES;

快速

self.navigationItem.rightBarButtonItem.enabled = true

如果您要隐藏右键栏按钮,请使用

目标C

self.navigationItem.rightBarButtonItem.enabled = NO;

快速

self.navigationItem.rightBarButtonItem.enabled = false

这篇关于如何在导航栏上设置颜色`rightBarButtonItem`?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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