ios - 让 UIImageView 通过点击查看它背后
问题描述
我有 UICollectionViewCell,其中有一个 100X100 的 UIImageView。我已向 collectionView 单元格内容视图添加了轻击手势。当用户单击图像时,不会调用 tagGesture 方法。任何方式我都可以让 UIImageView 将该手势传递给它后面的 contentView。我不想向 UIImageView 添加另一个点击手势。
解决方案
创建这个子类并将其设置为imageView的类名
class TransImgV:UIImageView {
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
return false
}
}
推荐阅读
- python - 使用中位数时面对“'numpy.ndarray'对象没有属性'median'”错误
- python - 如何断言如果方法没有返回语句而不在python中调用它
- onclicklistener - OnClickListener 抛出空指针引用
- google-apps-script - 使用循环脚本更新大量电子表格
- scala - 如何在 sbt 中按扩展名映射文件?
- kotlin - 如何在新版本的 Koin 中访问对象范围
- python - Python从文件夹中全部导入
- r - kableExtra 中列的背景颜色不起作用
- javascript - 为什么我的组件在状态更改(redux)时不重新渲染?
- git - Visual Studio 2019 在哪里寻找 Git?