我有带 TableView 的 ViewController。对于这个 TableView,我编写了自定义 TableViewCell 类。 我的单元格只包含 2 个标签。 我需要点击这些细胞然后做点什么。我试过
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
里面有一些警报,但什么也没发生。我不能使用一些方法,比如在单元格上使用不可见按钮,因为我必须从 TableView 获取一些数据,比如 indexPath 等。我不会在我的 customCell 类中获取这些数据。
最佳答案
使用didSelectRowAtIndexPath
而不是使用didDeselectRowAtIndexPath
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
关于ios - 处理 UITableView 中自定义单元格的点击不会发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22531146/