本文介绍了编辑/完成按钮,更改完成按钮背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UITableView,顶部有导航栏。我将导航栏的样式更改为 Black Opaque 以符合我的主题。

I have a UITableView with a navigation bar on the top. I changed the style of the navigation bar to Black Opaque to go with my theme.

我使用以下代码行添加了一个编辑按钮

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?

帮助将不胜感激

推荐答案

完成按钮始终为蓝色在UIBlackBarStyle导航栏上,但如果您使用navigationBar的tintColor属性在您选择的颜色中为其着色,则会调整其颜色。我没试过,但想法是设置

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. 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.

这篇关于编辑/完成按钮,更改完成按钮背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:58