edit/done button, change done button background color

我怕爱的太早我们不能终老 提交于 2019-12-08 13:32:41

问题


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?

Help would be appreciated


回答1:


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.



来源:https://stackoverflow.com/questions/5673722/edit-done-button-change-done-button-background-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!