Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.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中获取按钮的颜色_Ios_Iphone_Objective C_Ios4_Uibutton - Fatal编程技术网

在iOS中获取按钮的颜色

在iOS中获取按钮的颜色,ios,iphone,objective-c,ios4,uibutton,Ios,Iphone,Objective C,Ios4,Uibutton,在iOS中,您如何获得按钮的颜色?我设置了按钮的颜色。现在用另一种方法,我想得到它。是否有GetBackgroundColor方法?我没有看到。我用下面的代码设置颜色 [self.skinColourButton setBackgroundColor:[UIColor greenColor]]; 您正在寻找的方法是backgroundColor,如[self.skincolorbutton backgroundColor]。在Objective-C中,与-setWhatever:相对应的方法通

在iOS中,您如何获得按钮的颜色?我设置了按钮的颜色。现在用另一种方法,我想得到它。是否有GetBackgroundColor方法?我没有看到。我用下面的代码设置颜色

[self.skinColourButton setBackgroundColor:[UIColor greenColor]];

您正在寻找的方法是
backgroundColor
,如
[self.skincolorbutton backgroundColor]
。在Objective-C中,与
-setWhatever:
相对应的方法通常是
-whatever

您要查找的方法是
背景色
,如
[self.skincolorButton backgroundColor]
中的方法。在Objective-C中,与
-setWhatever:
相对应的方法通常是
-whatever

SkincolorButton
a
UIButton
或其他什么?我试过着色。这给了我黑色的背景。UIColor*newcolor=[self.skincolorbutton tintColor];self.view.backgroundColor=新颜色;虽然我的按钮不是黑色的,但它是绿色的。是
skincolorButton
a
ui按钮
还是别的什么?我试过着色。这给了我黑色的背景。UIColor*newcolor=[self.skincolorbutton tintColor];self.view.backgroundColor=新颜色;虽然我的按钮不是黑色的,而是绿色的。那么你是说像这样的东西?UIColor*newcolor=[self.skincolorButton getBackGroundColor];但是,这不起作用?否。
UIColor*newcolor=[self.skincolorbutton backgroundColor]
。没有“get”,并且“背景”中的“背景”没有大写。@CodeGeek123:true,或者干脆
self.skincolorButton.bakcgroundColor
Wonder。谢谢你回答了这个问题!你是说像这样的事?UIColor*newcolor=[self.skincolorButton getBackGroundColor];但是,这不起作用?否。
UIColor*newcolor=[self.skincolorbutton backgroundColor]
。没有“get”,并且“背景”中的“背景”没有大写。@CodeGeek123:true,或者干脆
self.skincolorButton.bakcgroundColor
Wonder。谢谢你回答了这个问题!