![](/img/trans.png)
[英]Objective-C method signatures: Parameter types can differ between declaration and implementation?
[英]Method and parameter declaration?
我有办法
-(void)continueSingle:(id)sender:(问题*)que {
我将这种方法添加到按钮作为目标
[continueButton addTarget:self action:@selector(continueButtonSingle:question:) forControlEvents:UIControlEventTouchUpInside];
没有错误或警告,但是,我正在将异常无法识别的选择器发送到实例
continueButtonSingle:question:
我不明白,我尝试了不同的组合,例如也将半冒号放在最后,但这仍然是一个问题。
该按钮如何知道如何发送您的问题和评论ID?
您可以执行以下操作:
[continueButton addTarget:self action:@selector(continueButtonComment:) forControlEvents:UIControlEventTouchUpInside];
然后传递给方法的参数是发送者,即按钮对象。
要访问方法中的questionId和注释,您可以为其创建属性并在方法中访问它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.