采用
[_scoreBox setIntValue:score];
或者
[self.scoreBox setIntValue:score];
*还要检查您是否最终比较了相同的按钮,如 : button==button
。
编辑2:
因为您的代码是:
int perus(int nappi){
}
将其更改为:
- (NSInteger *)perus:(NSInteger *)nappi{
//all should do inside, rest are OK.
}
编辑:
我不确定以下内容,因为在这里找到了这个
*我建议你切换到 obj-c 方法,而不是使用 C 函数来处理这类事情。
A C function is just that, a block of code not attached to anything
else. Your instance variable is attached to each Controller object.
So when you call printChatter() there is no way to know which
instance of Controller you want to use. You could add an object
variable to your function:
void namedfunction(const void *button, const void *appDele){
NSTextField *myButton=[appDele scoreBox];
....
}