简体   繁体   English

编辑/完成按钮,更改完成按钮背景颜色

[英]edit/done button, change done button background color

I have a UITableView with a navigation bar on the top. 我有一个UITableView,顶部有一个导航栏。 I changed the style of the navigation bar to Black Opaque to go with my theme. 我将导航栏的样式更改为Black Opaque以符合我的主题。

I added an edit button as well using the below line of code 我还使用下面的代码行添加了一个编辑按钮

self.navigationItem.leftBarButtonItem = self.editButtonItem;

All is fine so far, the edit button also appears in the balck opaque style. 到目前为止一切都很好,编辑按钮也出现在黑色不透明风格中。

however the done button appears in the default blue theme. 但是完成按钮出现在默认的蓝色主题中。 Am i missing some simple thing? 我错过了一些简单的事情吗? How should i change it? 我该怎么改变它?

Help would be appreciated 帮助将不胜感激

The done button is always blue on a UIBlackBarStyle Navigation bar, but will adjust its color if you use the tintColor property of the navigationBar to color it in your chose of colors. UIBlackBarStyle导航栏上的完成按钮始终为蓝色,但如果您使用navigationBar的tintColor属性在您选择的颜色中为其着色,则会调整其颜色。 I haven't tried it, but an idea would be to set 我没有尝试过,但一个想法是设置

self.navigationController.navigationBar.tintColor = [UIColor blackColor];

this should give you a Black navigation bar with a black done Button. 这应该会给你一个带黑色按钮的黑色导航栏。

However, for consistency reasons you can not directly set your custom background color on the done button. 但是,出于一致性原因,您无法在完成按钮上直接设置自定义背景颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM