我正在使用包含 ContainerView 的 UIViewController。在 ContainerView 内部我有一个 UITableViewController。我的 UIViewController 中有一个 PanGestureRecognizer,我用它来关闭它。现在我遇到的问题是,当我平移关闭 UIViewController 时,被触摸的 UITableViewController 内的 TableViewCell 会短暂突出显示。
我已在桌面 View 中禁用滚动,因为我不需要它。
我将其添加到我的平移手势处理程序的 .began
中,但没有任何效果:
myTableView.isUserInteractionEnabled = false
我也尝试过:
myGestureRecognizer.cancelsTouchesInView = true
但是触摸仍然传递到 TableView 并导致单元格突出显示。有什么解决办法吗?
最佳答案
我最终使用了这个:
myGestureRecognizer.delaysTouchesBegan = true
它可能并不适用于所有情况,但对于我的 TableView 来说,它可以防止突出显示的发生。
关于ios - 防止 UITableViewCells 在平移时突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56495283/