40

I've been googling around to try to figure out what sort of event handles are called when one row (or cell) in a UITableView is tapped, but haven't been able to figure it out. I'm trying to change the image property of the cell when it's tapped.

Thanks.

Arman
  • 856
  • 2
  • 10
  • 19

1 Answers1

99

There are two possible events when a table row is tapped: selecting the row and the accessory view (usually the "more details" type action).

As long as you have registered a delegate for the UITableView, the following can be implemented and will be called on a touch:

// Tap on table Row
- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath { ... }

// Tap on row accessory
- (void) tableView: (UITableView *) tableView accessoryButtonTappedForRowWithIndexPath: (NSIndexPath *) indexPath{ ... }
MystikSpiral
  • 5,018
  • 27
  • 22