点击自定义 UITableViewCell 内 UITextView 上检测到的数据会调用 didSelectRowAtIndexPath

发布于 2024-12-05 01:19:30 字数 341 浏览 0 评论 0原文

好吧,我一直在搜索我能想到的每个关键字组合,但尚未找到解决方案。每个人似乎都有与我所遇到的相反的问题。

我用 nib 文件构建了一个自定义 UITableViewCell。它有一个 UITextView,显示可检测的文本。

加载后,我可以看到文本已被检测到并在 UITextView 中突出显示,但是,当我单击它时,它会选择单元格,而不是检测到的数据。

UITextView 不可编辑并且用户交互已打开,因此我应该能够使其正常工作,不是吗?

有谁知道我可能需要做什么才能让它按预期工作?

如果我没有提供可以帮助您帮助我的信息,请告诉我,我会发布它。

提前致谢, 〜阿拉什

Alright, I have been searching every keyword combination i could think of but haven't found a solution to this yet. Everyone seems to have the opposite problem of what I am having.

I built a custom UITableViewCell with a nib file. It has a UITextView in it that displays detectable text.

After loading I can see the text has been detected and highlighted in the UITextView, however, when I go to click on it, it selects the cell, not the detected data.

The UITextView is not editable and user interaction is turned on so I should be able to get it working no?

Does anyone know what I might have to do to get it to work as intended?

If I didn't provide a piece of information that might help you help me, please let me know and I will post it.

Thanks in advance,
~Arash

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假扮的天使 2024-12-12 01:19:30

我知道这篇文章很旧,但我一直在尝试找出这个确切的问题,时间比我愿意承认的要长。希望这个答案对将来的人有所帮助。仅供参考...我此时使用的是 Xcode 4.3.2。

我的问题是“启用用户交互”。我为 UITextView 启用了它,但没有为自定义表格视图单元格启用它。如果表视图单元格关闭,则不会将任何触摸发送到单元格或其任何子视图(即 UITextView 或可能是 UIButton)。我修复后的唯一问题是,如果您触摸单元格中的其他任何位置,该单元格将被选中。我必须转到属性检查器,选择 UITableViewCell,然后将“选择”从“蓝色”更改为“无”。

现在一切都运转良好。

I know this post is old, but I have been trying to figure out this exact problem for more hours than I would like to admit. Hopefully, this answer helps someone in the future. FYI... I am using Xcode 4.3.2 at this time.

My problem was 'User Interaction Enabled'. I had it enabled for the UITextView, but not for the custom table view cell. If it is turned off for the table view cell, no touches will be sent to the cell or any of its subviews (ie. the UITextView or probably a UIButton). The only problem after I fixed that was that if you touched anywhere else in the cell, the cell would become selected. I had to go to the Attributes Inspector, select the UITableViewCell, and change 'Selection' from 'Blue' to 'None'.

Now everything is working great.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文