gpt4 book ai didi

ios - collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath 没有执行

转载 作者:行者123 更新时间:2023-11-28 13:52:14 26 4
gpt4 key购买 nike

这是我的 collectionViewCell 图像。

cell Image

我在 tableViewCell 中有 collectionView 并且在 collectionViewCell 中有一个按钮,它完全符合我的要求。但令我困扰的是函数 didSelectItemAt 没有被调用。

我试过

mycollectionview.isUserInteractionEnabled = true
mycollectionview.allowsSelection = true

但还是不行。当我在某处阅读时,collectionViewCell 中的按钮是否是其背后的原因。如果是这样,我该如何解决这个问题。

最佳答案

请确认您已将 UICollectionView 的委托(delegate)设置为您的 ViewController 而不是 TableViewCell。如果您已将委托(delegate)设置为 UITableViewCell,那么您的 didSelectItemAt 将在 TableViewCell 的 类中调用

关于ios - collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath 没有执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54400362/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com