UIBarbuttonItem change the textColor

岁酱吖の 提交于 2019-12-02 02:53:31

A UIBarButtonItem's color is its tintColor. (Or it can use the tintColor inherited from the toolbar you put it into.)

It seems UIBarButtonItems won't change it's tint color once they are added to the navigation bar.

What I did was to create a new one instead with new attributes.

let rightBarButtonItem = UIBarButtonItem(title: "Title", style: .plain, target: self, action: #selector(someAction))
rightBarButtonItem.tintColor = UIColor.white
navigationItem.rightBarButtonItem = rightBarButtonItem
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!