我有一个方法:带参数调用选择
-(void)pickTheQuiz:(id)sender etat:(int)etatQuiz{
//i need to get the etatQuiz value here
}
在我的代码
和地方,我调用上面的方法是这样的:
int etat_quiz=4;
[button addTarget:self action:@selector(pickTheQuiz:etat:)withObject:etat_quiz forControlEvents:UIControlEventTouchUpInside];
在这样做时,我得到错误:
Receiver type UIButton for instance message does not declare a method with selector 'addTarget:action:withObject:forControlEvent
编辑:
-(void)pickTheQuiz:(id)sender etat:(int)etatQuiz{
NSLog(@"The part number is:%i",((UIControl*)sender).tag);
}
如果我想传递多个信息?例如2个标签。 thnx提前。 – Luca 2012-03-15 09:13:25
请参阅http://stackoverflow.com/questions/3716633/passing-parameters-on-button-actionselector此链接 – Sree 2012-03-15 09:19:10