edit/done button, change done button background co

2019-06-11 10:31发布

问题:

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.