简体   繁体   中英

edit/done button, change done button background color

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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