📌  相关文章
📜  快速集合视图在滚动屏幕时取消选择项目 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:33.288000             🧑  作者: Mango

代码示例1
class MyViewController {

    var selectedIndexes = [IndexPath]()

    func cellForItem(indexPath) {
       cell.isSelected =  selectedIndexes.contains(indexPath)
    }

    func didSelectCell(indexPath) {
        if selectedIndexes.contains(indexPath) {
            selectedIndexes.remove(indexPath)
        } else if selectedIndexes.count < limiit {
            selectedIndexes.append(indexPath)
        }
    }
}