我在toolBar中有这两个按钮,想要改变UIBarButtons的颜色,我怎么能做这样的事情呢?我尝试过setTitleTextAttributes,但它似乎没有对象吗?我该怎么做?
UIBarButtonItem *sysDoneButton = [self createButtonWithType:UIBarButtonSystemItemDone target:self
action:@selector(actionPickerDone:)];
UIBarButtonItem *sysCancelButton = [self createButtonWithType:UIBarButtonSystemItemCancel target:self
action:@selector(actionPickerCancel:)];发布于 2014-11-13 19:46:44
UIBarButtonItem的颜色是它的tintColor。(也可以使用从工具栏继承的tintColor。)
发布于 2017-10-03 20:08:37
似乎UIBarButtonItems不会改变它的色调,一旦它们被添加到导航栏中。
我所做的是创建一个新的属性,而不是一个新的属性。
let rightBarButtonItem = UIBarButtonItem(title: "Title", style: .plain, target: self, action: #selector(someAction))
rightBarButtonItem.tintColor = UIColor.white
navigationItem.rightBarButtonItem = rightBarButtonItemhttps://stackoverflow.com/questions/26917055
复制相似问题