EDIT: Another option is to expose the UIButton
property on your cell publicly, and in cellForRowAtIndexPath
: call addTarget:action:forControlEvent:
on the cell's button, passing self and the method on your view controller that you wish to be called on touch. This precludes any need for a delegate protocol. The only catch is that before you set the target-action on the cell's button, make sure to call:
[cell.button removeTarget:nil
action:NULL
forControlEvents:UIControlEventAllEvents];
Since the cell (and it's button) is reused, you need to call this is to make sure you're not stacking target-actions on the button.