
@property (weak) IBOutlet NSTextFIEld *scoreBox;
正确的,我正试图像这样访问它:
voID namedfunction(button) { if (button == button) { score = score + 100; [scoreBox setIntValue:score]; // ^ error }} 我收到这个错误:
AppDelegate.m:52:10: Use of undeclared IDentifIEr ‘scoreBox’
我究竟做错了什么?
解决方法 使用[_scoreBox setIntValue:score];
要么
[self.scoreBox setIntValue:score];
*同时检查您最终是否比较相同的按钮,如:button ==按钮.
编辑2:
因为你的代码是:
int perus(int nappi){} 将其更改为:
- (NSInteger *)perus:(NSInteger *)nappi{ //all should do insIDe,rest are OK.} 编辑:
我不确定这个here发现了以下内容
*我建议你切换到obj-c方法,而不是使用C函数来做这种事情.
C函数只是一个代码块,没有附加到任何东西
其他.您的实例变量附加到每个Controller对象.
所以当你调用printChatter()时,无法知道哪一个
您要使用的Controller实例.你可以添加一个对象
变量到你的功能:
voID namedfunction(const voID *button,const voID *appDele){ NSTextFIEld *mybutton=[appDele scoreBox]; ....} 总结 以上是内存溢出为你收集整理的c – Xcode在函数中使用时如何使用IBOutlet进行标记全部内容,希望文章能够帮你解决c – Xcode在函数中使用时如何使用IBOutlet进行标记所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)