How can I pass an argument in the @selector for my code below?
[thisIconBtn addTarget:self action:@selector(changeIconState) forControlEvents:UIControlEventTouchUpInside];
-(void)changeIconState:(UITableViewCell*)thisCell
{
//do something
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, the colon is part of the selector:
@selector(changeIconState:).Second, actions are methods that take a particular set of parameters — you can’t just use any method as an action. Usually, actions look like this:
where sender is a pointer to the object that’s sending the action. In your code, when thisIconButton is tapped, that button would be passed as the sender.