ios - 防止 UITableViewCells 在平移时突出显示
问题描述
我正在使用包含 ContainerView 的 UIViewController。在 ContainerView 里面我有一个 UITableViewController。我的 UIViewController 中有一个 PanGestureRecognizer,我用它来关闭它。现在我遇到的问题是,当我平移以关闭 UIViewController 时,被触摸的 UITableViewController 内的 TableViewCells 会短暂突出显示。
我在我的表格视图中禁用了滚动,因为我不需要它。
我将此添加到我的平移手势处理程序中.began
,但没有任何效果:
myTableView.isUserInteractionEnabled = false
我也试过:
myGestureRecognizer.cancelsTouchesInView = true
但触摸仍然传递给 TableView 并导致单元格突出显示。有什么解决办法吗?
解决方案
我最终使用了这个:
myGestureRecognizer.delaysTouchesBegan = true
它可能不是在所有情况下都有用,但对于我的 TableView 来说,它可以防止亮点发生。
推荐阅读
- javascript - 更改 src 后如何使视频重新加载?
- typescript - 如何获取从类实例克隆的对象的类型?
- uwp - UWP:需要在文本框单击时禁用屏幕键盘
- java - 用Java中的参数覆盖抽象父级中的方法
- neo4j - Neo4j,后续 MATCH 路径查询
- asp.net-web-api - .NET Core Web API 中后控制器模型中未提供的属性的块设置默认值
- git - git 忽略所有文件,除了一个类型的文件,期望忽略一个类型的文件,通过更新现有 repo 中的 .gitignore
- mysql - MySQL 将 ISO 日期转换为日期时间
- sql - 在 BigQuery 中更新 Firebase 事件表中的数据
- image - Pythonanywhere 将图像文件保存在一步父目录而不是正确的目录中。*开发服务器进展顺利)