How to do action using Button in UITableViewCell?
问题 i have a button that i create in my CustomCell. - (IBAction)onoffBtn:(id)sender { UIButton *button = (UIButton *)sender; button.selected = !button.selected; if (button.selected) { // Do action 1 } else { // Do action 2 } } When i run it, the button is show in my cell inside UITableView that i create in TableViewController. I can press that onoffBtn inside my cell but it cant do action. How do i do so that my button can do action? this is my cellForRowAtIndexPath inside my TableViewController