I have a setup with UITableViewCells that contain some buttons. When clicking some of the buttons, the UIView containing those buttons will change. Unfortunately, this causes the cell to be selected, while the button actually captured the touch (this works fine if the containing view is not changed upon touch).
Is there a way to prevent the touch from passing on to the cell once it has been detected by a UIButton once?
If you implement
for the hosting table view and return nil for the row that contains the button, then it will not be selected when you tap the button.
If you need the row to select when the user taps anything other than the button, then you can just call [tableVeiw deselectRowAtIndexPath:indexpathForButton animated:NO] in your button’s action method