在UITextView上点击时,UICollectionView didSelectItemAtIndexPath未被调用 [英] UICollectionView didSelectItemAtIndexPath not called when tapped on UITextView

查看:90
本文介绍了在UITextView上点击时,UICollectionView didSelectItemAtIndexPath未被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有自定义单元格的 UICollectionView - 它们有一个 UITextView ,它主要覆盖整个单元格。使用 didSelectItemAtIndexPath 时出现问题。触发它的唯一方法是在 UITextView 之外点击。我想让它在你点击的单元格中触发,无论是否有文本视图。怎么办呢?

I have a UICollectionView with custom cells- They have a UITextView that mostly covers the entire cell. This presents a problem when using didSelectItemAtIndexPath. The only way to trigger it is by tapping outside the UITextView. I want it to trigger wherever in the cell you tap, whether there is a text view or not. How can this be done?

推荐答案

我建议使用 UIGestureRecognizer 对于每个单元格以及它被录制以将其发送到 UITextView 或者其他什么,也许可能有更好的解决方案,但我会因为简单原因而使用这个。

I would suggest to use UIGestureRecognizer for each cell and when it taped to send it to UITextView or whatever , perhaps there maybe a better solutions , but I would use this 1 because of simplicity reasons.

这篇关于在UITextView上点击时,UICollectionView didSelectItemAtIndexPath未被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆