Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIBarbuttonItem更改文本颜色_Ios_Objective C_Iphone_Uibarbuttonitem - Fatal编程技术网

Ios UIBarbuttonItem更改文本颜色

Ios UIBarbuttonItem更改文本颜色,ios,objective-c,iphone,uibarbuttonitem,Ios,Objective C,Iphone,Uibarbuttonitem,我在工具栏中有这两个按钮,想更改UIBarButtons的颜色我怎么能做这样的事情?我尝试过setTitleTextAttributes,但它似乎没有这样的对象?我该怎么做 UIBarButtonItem *sysDoneButton = [self createButtonWithType:UIBarButtonSystemItemDone target:self action:@

我在工具栏中有这两个按钮,想更改UIBarButtons的颜色我怎么能做这样的事情?我尝试过setTitleTextAttributes,但它似乎没有这样的对象?我该怎么做

UIBarButtonItem *sysDoneButton = [self createButtonWithType:UIBarButtonSystemItemDone target:self
                                                         action:@selector(actionPickerDone:)];

UIBarButtonItem *sysCancelButton = [self createButtonWithType:UIBarButtonSystemItemCancel target:self
                                                           action:@selector(actionPickerCancel:)];

维吾尔人的颜色就是它的颜色。或者,它可以使用从工具栏继承的tintColor。UIBarButtonItem的颜色就是它的tintColor。或者,它可以使用从您将其放入的工具栏继承的色调。

UIBarButtonims似乎在添加到导航栏后不会更改其色调

我所做的是用新属性创建一个新的

let rightBarButtonItem = UIBarButtonItem(title: "Title", style: .plain, target: self, action: #selector(someAction))
rightBarButtonItem.tintColor = UIColor.white
navigationItem.rightBarButtonItem = rightBarButtonItem

看起来uibarbuttonems在添加到导航栏后不会改变它的色调

我所做的是用新属性创建一个新的

let rightBarButtonItem = UIBarButtonItem(title: "Title", style: .plain, target: self, action: #selector(someAction))
rightBarButtonItem.tintColor = UIColor.white
navigationItem.rightBarButtonItem = rightBarButtonItem

示例中的语法是Objective-C,示例中没有显示任何颜色。但是创建一个uibarbuttonite并将其链接到选择器。我不确定您是否询问如何将上述代码转换为Swift。你能澄清一下吗?我试着用Objective C来做这个例子中的语法是Objective-C,而这个例子没有显示任何关于颜色的信息。但是创建一个uibarbuttonite并将其链接到选择器。我不确定您是否询问如何将上述代码转换为Swift。您能澄清一下吗?Sry试图用Objective Color做这件事是行不通的?这可能是因为我已经为appDelegate中的所有应用了颜色吗?tintColor不起作用。我还尝试了[navigation.navigationItem.LeftBarButtonim setTitleTextAttributes:[NSDictionary Dictionary WithObjectsAndKeys:];但是一点运气都没有。是因为我在appDelegate中申请了所有导航项颜色吗?@OceanBlue不要在评论中偷看;问一个新问题颜色不起作用?这可能是因为我已经为appDelegate中的所有应用了颜色吗?tintColor不起作用。我还尝试了[navigation.navigationItem.LeftBarButtonim setTitleTextAttributes:[NSDictionary Dictionary WithObjectsAndKeys:];但是一点运气都没有。是因为我在appDelegate中申请了所有导航项颜色吗?@OceanBlue不要在评论中偷看;问一个新问题