UITableView/UITableViewCell tap event response?

前端 未结 1 1259
走了就别回头了
走了就别回头了 2021-02-02 06:57

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.

相关标签:
1条回答
  • 2021-02-02 07:39

    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{ ... }
    
    0 讨论(0)
提交回复
热议问题