uitableview - 手势识别器和 TableView

标签 uitableview uigesturerecognizer

我有一个 UIView,它覆盖了 UITableView 的所有内容。 UIView 使用手势识别器来控制表格显示的内容。 我仍然需要垂直 UITableView 滚动和行点击。 如何将这些从手势识别器传递到表格?

最佳答案

如果您需要知道单元格的索引路径:

- (void)handleSwipeFrom:(UIGestureRecognizer *)recognizer {
    CGPoint swipeLocation = [recognizer locationInView:self.tableView];
    NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:swipeLocation];
    UITableViewCell *swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath];
}

这个问题之前已在 UIGestureRecognizer and UITableViewCell issue 中得到解答。 .

关于uitableview - 手势识别器和 TableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4454920/

相关文章:

ios - TableView 框架显示在意外位置

ios - 如果用户在负方向平移 x 和 y,UIPanGestureRecognizer 不会切换到状态 "End"或 "Cancel"

ios - 禁用屏幕左边缘的 3D Touch 任务切换器手势

ios - 无法使用 swift 在 AVPlayerViewController 上捕获滑动手势

iOS : Transfer Scroll Gesture on a View to Another

ios - 检测手指向上/向下 UITapGestureRecognizer

ios - 在具有恒定高度约束的 ScrollView 中初始化 UICollectionViewCells

ios - 删除自定义标题 TableView 中的底线

ios - 是否可以有一个带有两个 UITableView 的 UIViewController,以及两个相应的 NSFetchedResultsController?

iphone - 按用户编辑 Uitableviewcell 内容