【问题标题】:How to call didDeselectRowAt of tableView in a collectionView如何在collectionView中调用tableView的didDeselectRowAt
【发布时间】:2017-07-12 07:50:33
【问题描述】:

我有一个 collectionView 和一个 tableView。当我在 tableView 上切换一个单元格时,它会将该单元格添加/删除到 collectionView。当我单击它时,从 collectionView 中删除一个单元格。单击collectionView的单元格时,我想调用tableView的didDeselctRowAt。

tableView(tableView, didDeselectRowAt: indexPath) // in collectionView

上述方法有效。但是,当我再次单击 tableView 单元格时,此方法再次调用。有没有类似的财产

cell.isDidDeselect = true // cell of tableView

为了防止再次调用它。

【问题讨论】:

    标签: uitableview swift3 uicollectionview


    【解决方案1】:

    从问题到答案的移动解决方案:

    更新和回答

    我找到了答案:

    使用

    tableView.deselectRow(at: indexPath, animated: true)
    tableView.delegate?.tableView!(tableView, didDeselectRowAt: indexPath)
    

    而不是

    tableView(tableView, didDeselectRowAt: indexPath)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多