ios - 无法识别 UITableViewCell 中的 UITapGestureRecognizer

标签 ios objective-c uitableview

我做了相当多的定制 UITableView,它有 3 行,每一行都是使用 UITableViewCell 定制的。我在 UITableViewCell 中添加了几个 UIView 以及 UITapGestureRecognizer

由于 UITableViewCell 中有许多小 View ,我在那个 UITableViewCell 的“m”文件上实现了触摸事件代码。

识别器无法正常工作。我不确定我在这里提供了足够的信息..

更新:我意识到我的解释还不够..所以更详细一点。

这就是我的 UITableView 的样子,

UITableViewUITableViewCell(A)。 UItableViewCell(A) 的 contentView 由 6 个其他 UITableViewCells(B) 组合而成。 每个 UITableViewCells(B) 都有一些 UIViews,它们具有那些 TapGesture 识别器。

我知道它看起来过于复杂,但我使用 UITableViewCell(B) 不是为了重用,而是为了重复的 Nib 文件。无论如何,最终的 UIView 不会接受任何触摸事件。

最佳答案

UITableView 有自己的点击手势来选择行。您可以通过在以下函数中实现您的代码来做到这一点。你能告诉我你用什么来实现选择行

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
} 

关于ios - 无法识别 UITableViewCell 中的 UITapGestureRecognizer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29639162/

相关文章:

php - 在浏览器中模拟 cordova 应用程序

ios - usleep 在 iOS 中不起作用

c++ - 架构 arm64 的 undefined symbol : "cv::String::deallocate()"

ios - 使用 OCMockito 模拟无效的方法

objective-c - iOS/xcode : didReceiveData empty when run on device but fine on simulator?

ios - 在 iOS 中使用手指在两点之间画线并拖动/弯曲该线?

ios - 定义模态视图尺寸 ?

ios - 如何多次使用相同的 UIPickerView 和不同的数据? - swift

ios - 先执行代码! swift

arrays - 仅在匹配当前用户数据时获取用户数据