私は方法持っているとセレクタを呼び出す:引数
-(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
EDIT:
-(void)pickTheQuiz:(id)sender etat:(int)etatQuiz{
NSLog(@"The part number is:%i",((UIControl*)sender).tag);
}
と私は複数の情報を渡したい場合は?たとえば2つのタグがあります。 thnxは事前に。 – Luca
http://stackoverflow.com/questions/3716633/passing-parameters-on-button-actionselectorこのリンクをご覧ください – Sree