I have a UITableViewCell with 3 checkmark buttons. Each checkmark button is a custom UIButton (just the images really), and have an outlet in the custom UITableViewCell subclass. In the cellForRowAtIndexPath method, I
[cell.firstcheckmark addTarget:self action:@selector(checkmarkPressed:) forControlEvents:UIControlEventTouchUpInside];
[cell.secondcheckmark addTarget:self action:@selector(checkmarkPressed:) forControlEvents:UIControlEventTouchUpInside];
[cell.thirdcheckmark addTarget:self action:@selector(checkmarkPressed:) forControlEvents:UIControlEventTouchUpInside];
- (void)checkmarkPressed:(id)sender {
// how do I get which checkmark was pressed?
}
I was not sure how to get which button was pressed from the sender object. Other times I can use the title of the button, but in this case, all the buttons are the same except their outlet. How do I get which button was pressed? Or do they each need to call a different method, and then in each of those three methods, I can update my model by calling the same modelUpdateMethod: from each of those three methods? Thanks.
You can identify them by their tag:
And then