Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.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
Objective c 设置按钮名称,但不使用单词";“自我”;_Objective C - Fatal编程技术网

Objective c 设置按钮名称,但不使用单词";“自我”;

Objective c 设置按钮名称,但不使用单词";“自我”;,objective-c,Objective C,UIButton*button=[self-valueForKey:[NSString stringWithFormat:@“buttonA”] 有没有一种方法可以在不使用“self”这个词的情况下做同样的事情?self是该类的当前实例 这是最好的方法 除了self之外,还需要创建另一个对象实例并使用该对象 MyClass *classObject=[MyClass new]; UIButton * button = [classObject valueForKey: [NSString str

UIButton*button=[self-valueForKey:[NSString stringWithFormat:@“buttonA”]


有没有一种方法可以在不使用“self”这个词的情况下做同样的事情?

self
是该类的当前实例

这是最好的方法

除了self之外,还需要创建另一个对象实例并使用该对象

MyClass *classObject=[MyClass new];
UIButton * button = [classObject valueForKey: [NSString stringWithFormat: @"buttonA"];

你不应该这样做。“自我”有什么问题?打扰了你吗?我试着在C++函数中使用这个代码(使用ObjuleC++)。C++函数不能使用“自我”。然后解释你的问题…