So I want three buttons in my tableView cell. I've made a custom cell so I customize the buttons in the custom cell once instead of doing it again and again in cellForRowAtIndexPath
But I want to add a selector to all three buttons, for which I am using
[cell.btn1 addTarget:self action:@selector(firstAction:) forControlEvents:UIControlEventTouchUpInside];
inside cellForRowAtIndexPath
. is that the best way to go about it? wont addTarget be initialize and reinitialize itself everytime I scroll through my cells? wont that be an extra overload? is there a better way of doing this that I dont know about?
edit
This is how I figure-out which cell the button belongs to that was pressed
CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.feedTableView];
NSIndexPath *indexPath = [self.feedTableView indexPathForRowAtPoint:buttonPosition];