问题描述
我似乎在堆栈的任何地方都找不到这个,因为每个解决方案都提到了如何通过 AppDelegate
或通过设置 appearance 来设置自定义外观.>
我所需要的只是使用来自类扩展(添加到项目中)的名为 colorWithHexString:
).
我的财产:
@property (weak, nonatomic) IBOutlet UIBarButtonItem *grNextButton;
我想在我的 .m 文件中使用什么:
grNextButton.tintColor = [UIColor colorWithHexString:@"#669900"];
成功更改grNextButton
需要什么代码?
使用RGBcolor
这样的代码,希望能解决你的问题.
grNextButton.tintColor = [UIColor colorWithRed:255/255.0f绿色:50/255.0f蓝色:60/255.0f阿尔法:1.0f];
我使用的颜色代码是示例颜色代码,您可以从中选择合适的颜色代码这里
I can't seem to find this anywhere on stack because every solution just mentions how you can set your custom appearance through AppDelegate
or through setting the appearance.
All I need is to set ONE and only this one UIBarButtonItem
to a custom hexColor using a method called colorWithHexString:
that comes from a class extension(added to the project).
my property:
@property (weak, nonatomic) IBOutlet UIBarButtonItem *grNextButton;
what I'm trying to use in my .m file:
grNextButton.tintColor = [UIColor colorWithHexString:@"#669900"];
What is the code that I need to successfully change grNextButton
?
Use RGBcolor
code like this, hope it will solve your problem.
grNextButton.tintColor = [UIColor colorWithRed:255/255.0f
green:50/255.0f
blue:60/255.0f
alpha:1.0f];
The color code I used are example color code you can choose your appropriate color code fromhere
这篇关于使用 IBOutlet 设置一个 UIBarButtonItem 的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!